Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

vipinkavlar/node-express-typescript-mysql-swagger

Repository files navigation

node-express-typescript-mongodb-swagger

Please follw the below steps:

git clone https://github.com/vipinkavlar/node-express-typescript-mongodb-swagger.git
cd node-express-typescript-mongodb-swagger
npm install
npm run dev

Swagger documentation sample can be found at http://localhost:/api-docs

Form input validation

Input validation is done through class-validator. The decorators are defined in src/dtos files. Two middleware can be used to process error responses.

  1. ../middlewares/validation.middleware
  2. ../middlewares/validationJsonResponse.middleware

validationJsonResponse will output the response in JSON format as given below:

{
message : null,
data: null,
errorCode : 201
errorMessages : {
"email": {
"isNotEmpty": "email should not be empty",
"isEmail": "email must be an email"
},
"password": {
"isString": "password must be a string"
}
}
}

validationMiddleware sends HTTP response. Usage of both middlewares can be seen in the routes/user.route.ts file

About

Node Express framework integrated with Typescript and MySQL as database without any ORM

Topics

Resources

Readme

License

MIT license

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors