postman.mp4
git clone https://github.com/meleshyn/nestjs-jwt-sequelize-app.git
cd nestjs-jwt-sequelize-appnpm installdocker run --rm --name mysql-nest-dev \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_DATABASE=dev \
-p 3306:3306 \
-d mysql:latest- Note: The
-rmflag ensures the container is removed after stopping, deleting all data.
npm run migratenpm run start- Base URL:
http://localhost:3000/api/v1
- JWT Tokens: Pass the JWT token in the
Authorizationheader asBearer <token>.
-
URL:
/register -
Method:
POST -
Description: Registers a new user.
-
Request Body:
{ "name": "John Doe", "email": "john.doe@example.com", "phone": "1234567890", "password": "securepassword" } -
Response:
{ "id": 1, "name": "John Doe", "email": "john.doe@example.com", "phone": "1234567890" }
-
URL:
/login -
Method:
POST -
Description: Logs in a user and returns an access token.
-
Request Body:
{ "email": "john.doe@example.com", "password": "securepassword" } -
Response:
{ "access_token": "<JWT_TOKEN>" }
-
URL:
/user -
Method:
GET -
Description: Retrieves authenticated user data.
-
Headers:
Authorization: Bearer <JWT_TOKEN> -
Response:
{ "id": 1, "name": "John Doe", "email": "john.doe@example.com", "phone": "1234567890" }