This repository is the part of the ColorsMosaic project containing REST API of the application.
The goal is to create a small REST API in Typescript. Application needs to be able to service frontend part of the application.
The idea for this application was to create a tool in the form of a website for viewing and creating color sets. It would help in creating mobile and web application projects.
This API was created for the the needs of the project involving two separate parts that make up a web application. This repository contains the backend part of the application and is responsible for connection the frontend part with database of the application. REST API can sign in a new user and sigh up already existing with using JWT for access and refresh token. Other functionalities include searching the database for saved user's colors and sets of colors. Database also contains pre created colors sets.
- User authentication
- User authorization
- Logout user
- Account verification with mail
- Saving new colors for users
- Getting user's saved colors
- Getting user's saved colors sets
- Getting most popular colors from external sources
- Getting pre created colors sets from external sources
- Express.js as the framework
- MongoDB as database technology
- Swagger in use for API documentation
- User authentication is based on JWT access and refresh token
- During user's authentication, the application will recognize user's agent
- Pre created colors sets are fetch from external sources
- Sessions will be stored in database in dedicated cluster
- AccessToken expire after 15 minutes and refresh token after 1 year
- Tests
[ work in progress ]
[ Here will be a set of instructions to user this repository ]
HTTP | Endpoint | Action |
---|---|---|
POST | /api/auth/register | New user authentication |
POST | /api/auth/login | User authorization |
POST | /api/auth/logout | User logout |
GET | /api/user/colors | Get user's colors |
GET | /api/user/colors-sets | Get user's colors sets |
POST | /api/user/colors | Save new user's color |
DELETE | /api/user/colors/:id | Delete user's color |
DELETE | /api/user/colors-sets/:id | Delete user's colors set |
[ temporary demo ]
|
├── config
| └──default
├── src
│ ├── controllers
│ ├── interfaces
│ ├── middlewares
│ ├── models
│ ├── routes
│ ├── services
│ ├── utils
│ ├── App.ts
│ └── index.ts
├── .env
├── package-lock.json
├── package.json
└── tsconfig.json