Skip to content

Latest commit

 

History

History
140 lines (95 loc) · 2.61 KB

README.md

File metadata and controls

140 lines (95 loc) · 2.61 KB

Technologies used to build this project:

Requirements to run the API:

Installation

After you have Docker installed yout should do the following steps:

  • Clone the project
  git clone [email protected]:galleonpt/outvio.git <folder_name>
  • Go to the project directory
  cd <folder_name>
  • Run to start all containers:
  docker-compose up -d

If you want to know when the API is ready to be used run the command bellow and see a message like Server on!

  docker logs -f --tail 50 app_outvio
  • After that you are ready to use the API.

API Endpoints Documentation

I recommend using Postman or Insomnia to see the API working. During development I used insomnia.

Base url

  http://localhost:3333

Public route

Endpoint

  GET /public

Response

{
	"route": "/public",
	"amountOfRequests": number, //Number of requests made until ttl resets
	"ttl": number //Time-to-live in seconds
}

Private route

Endpoint

  GET /private

Note

  • To use this route you need do set a jwt token on headers. To do that got to jwt site and create a token with the same secret key that is on "src/config/config.ts"

Response

{
	"route": "/private",
	"amountOfRequests": number, //Number of requests made until ttl resets
	"ttl": number //Time-to-live in seconds
}

Contributing

Contributions are always welcome!

If you want to contribute you must:

  • Clone the project
  • Create a branch and code what you want
  • Commit your code
  • Push it
  • Create a pull request

Start Guide

When you clone the repository you will have the following folder architecture:

src
├── @types
│    └── express
│        └── index.d.ts
│── config
│   └── config.ts
├── middlewares
│   └── ensureAuthenticated.ts
│   └── rateLimiter.ts
├── app.ts
├── redis-client.ts
├── routes.ts
└── server.ts

At the root of the project you will have src folder witch is where all the code is developed.

Inside src we have 3 folders:

  • @types: where we can add properties to express objects;
  • config: folder where all config variables are;
  • middlewares: here is where all middlewares used on the endpoints are.