Hello everyone, welcome to Learn Tech Tips I am Zidane, (my nickname: ιΈ‘θ)
Good day to you. This series will share with you how to build a web application with server, client side, and you will learn many useful things on this project.
As the title you will learn how to
- Use NestJs build a server connect with a MongoDB (use JWT for authentication, how to query on server, create schema, entity, controller, service)
- Use NextJS build a client side with TailwindCss fast build component, Zustand state management (easy manage state), Axios Request API.
After check all this full series, I believe you will have a mindset how to build a website app from backend to frontend. You will understand how to become a full stack developer through this todo web app
Full Tutorial "TodoList Apps with NextJS Zustand" Axios TailwindCSS React NestJS Mongoose JWT (Day 5)
On day 5: We will focus on how to work with @Body, @Param, @Query
Let double check src/todos/todos.controller.ts
we will action on search function, and here is controller of todos
UseGuards(JwtAuthGuard)
@Get('search')
public async search(
@Request() req: any,
@Query('limit') limit: number,
@Query('page') page: number,
@Query('job') job: string,
@Query('type') type: number,
@Query('status') status: string
) {
return await this.todosService.search(req.user.params.username, limit, page, job, type, status);
}
We're using @Query on search query
Here is the @Param example
@UseGuards(JwtAuthGuard)
@Patch(':id')
public async changeStatusTodo(@Param('id') id: string) {
return await this.todosService.changeStatusTodo(id);
}
Here is the @Body example
@UseGuards(JwtAuthGuard)
@Post()
public async create(@Request() req: any, @Body() todosDto: TodosDto) {
return await this.todosService.create(todosDto, req.user.params.username);
}
![Full Tutorial Todo web app with NextJS Zustand Axios TailwindCSS React NestJS Mongoose JWT - How to use @Body, @Param, @Query - postman - Webzone tech tips [Project Day 5] Full Tutorial Todo web app with NextJS Zustand Axios TailwindCSS React NestJS Mongoose JWT - How to use @Body, @Param, @Query - postman](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMll7EqmAASwbNGZsEFY3uUAT8i0Tl0nEsrB8Pi4_49tORNtHl8zpae4dNfFe5gTVmqkeUx9uQoA0RM4_w3PjIeq0mu65gdc1zLQrNHlyY_WP51X-mgqNxl4RL1PMw1SefIf6YzO50CI7YOQWoYLQLsw4mPbqMzi8jOErVPbbG8Uaw0MExaZ2cdSjJ/s16000/query.jpg)
![Full Tutorial Todo web app with NextJS Zustand Axios TailwindCSS React NestJS Mongoose JWT - How to use @Body, @Param, @Query - postman - Webzone, tech tips nestjs [Project Day 5] Full Tutorial Todo web app with NextJS Zustand Axios TailwindCSS React NestJS Mongoose JWT - How to use @Body, @Param, @Query - postman](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimAOBglR8pwCr8cOSN_KweQhBTcEqVfJZm9S-7e3-Aql22OB4HTLl3q7qKtXJ02JSpAMYWEWYZp7GszcnAB93ZRoIjRSuNi1vgP9eYwG4jWoWYafPd7kB3AcvTk_EXCr6fCV_XDWFYQ5s3hFguao8HR2xB_MHxuPhlCMpbPLCEBT4WPz3sdzy5mKhY/s16000/param.jpg)
![Full Tutorial Todo web app with NextJS Zustand Axios TailwindCSS React NestJS Mongoose JWT - How to use @Body, @Param, @Query - postman - Webzone tech tips zustand react [Project Day 5] Full Tutorial Todo web app with NextJS Zustand Axios TailwindCSS React NestJS Mongoose JWT - How to use @Body, @Param, @Query - postman](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXayn4e9LOud0Dp2z-U4wSOLCmD_gTQrxy4EQJJ-TmkBOIKoYOqlseRNDRE697R5tY82lI9Q2UtibIXYmXA18S5xLu4sSdWhTu6KeRD8pZz0RdE2bbRAgjJHeOwoJxns05k5VS0JOBlzNphYyIYekkFswK9Gl3P3J7EHwJf-8TzGNL_P6KtO7Qy-Xh/s16000/body.jpg)