This project contains REST API endpoint for authentication and posts. It is developed in Express.js utilizing Typescript and MongoDB as the database of choice.
- ESLint
- Airbnb
- Prettier
- Javascript / Typescript
- MongoDB
- Authentication - using JWT
- /api/auth/register
- /api/auth/login
- Posts
- /api/posts - GET | POST[CREATE]
- /api/posts/:id - GET | PUT | DELETE
- Auth - For authentication to avoid unauthorized access
- Error - For error handling to display custom user-friendly error messages
Config file has not been added due to availability of sensitive information, however a config.env.example file is available with the requred config variables and value placeholders
- controllers - contains all controller methods passed to routes
- auth
- post
- handlers
- asyncWrapper
- HttpException
- interfaces
- post
- user
- middleware
- auth
- errors
- models
- index
- Post
- User
- routes
- auth
- posts
- index.ts
The project has multiple npm run scripts for compilation, linting and running
- Typescript compilation
npm run build
oryarn build
- Run project on Typescript src/
npm run server
oryarn server
- Run project with Javascript on build/
npm run start
oryarn start
- Linting
npm run lint
oryarn lint