Backend API with authentication and authorization doing crud operations. Used state of art libs for clean and efficient code.
- I used postman for making request so i saved all my request and aded here in this project as cloud it is post man collection json file.
- User Registration and Authentication
- Vehicle Preferences
- Logging
- Documentation(i showed you basic example using apidoc lib)
- clone the repo
$ npm i
$ npm start
npm start will start the server on port 3000 which is .env file. You can change portnumber according to your wish.
- For generating api doc
npm install -g apidoc
apidoc -i src/ -o apidoc/
user-management-api/
|-- build/
|-- src/
| |-- controllers/
| | |-- userController.ts // for creating, deleting updating, reading users (endpoints)
| |-- database/ // I am using json file as db for storing details about user(array of users) and vechiles
| | |-- users.json
| | |-- vehicle.json
| |-- dto/ //types
| | |-- user.dto.ts // type of user
| |-- interfaces/
| | |-- responseInterfaces.ts // interface of responses
| |-- middelware/
| | |-- authMiddleware.ts // authentication middleware for accessing resources
| | |-- validationErrors.ts //if we make error request then structured understandable error response is sent
| |-- services/ //for accessing database
| | |-- userService.ts // for CRUD on users database (users.json)
| |-- index.ts/ // main file
|-- .env/ // basic project settings
|-- package.json
|-- README.md
|-- tsconfig.json