Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/serhiinikif/todo-list-nest


https://github.com/serhiinikif/todo-list-nest

bcryptjs class-validator cross-env docker-compose dotenv error-handling jwt middlewares nestjs nodejs postgresql rest-api sequelize-orm swagger-ui typescript uuid yml

Last synced: 26 days ago
JSON representation

Awesome Lists containing this project

README

        

# How to use

## 1. Clone Project into your local machine
```
git clone https://github.com/SerhiiNikif/todo-list-nest.git
```

## 2. Go into project folder

```
cd todo-list-nest
```

## 3. Setting environment file .env.
Create an `.development.env` file in the root of the project and fill it with the values ​​from the `.development.env.example` file.

```
PORT=7000
POSTGRES_HOST=postgres
POSTGRES_USER=db_user
POSTGRES_PASSWORD=db_password
POSTGRES_DB=db_name
POSTGRES_PORT=5432
PRIVATE_KEY=secret_key
```

> Depending on how you run the project, the value of the __POSTGRES_HOST__ variable will change:

__docker__:
POSTGRES_HOST=postgres

__locally__:
POSTGRES_HOST=localhost

## 4. Start project
> #### Docker need to be installed in your OS. To install Docker, please click [here](https://docs.docker.com/get-docker/).

Enter this command so that the dist folder appears (it is needed in the Dockerfile)
```
npm run build
```

```
docker-compose up
```

Or run the project locally
```
npm install
```

```
npm run start:dev
```

## 5. Play with APIs now !
Now, you are ready to test all APIs.
Just simply open your browser http://localhost:5000/api/docs.

> All APIs are protected by accessToken (JWT).

## When calling these protected APIs, make sure you add %BearerToken% in `Authorization` request Header.

```
Authorization: Bearer
```

## How to get accessToken ?

When user login sucessfully, an unique accessToken will be returned.