- Docker installed
After you have Docker installed yout should do the following steps:
- Clone the project
git clone git@github.com: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.
I recommend using Postman or Insomnia to see the API working. During development I used insomnia.
http://localhost:3333
Endpoint
GET /public
Response
{
"route": "/public",
"amountOfRequests": number, //Number of requests made until ttl resets
"ttl": number //Time-to-live in seconds
}
Endpoint
GET /private
- 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
}
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
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.