GratiBox (back-end)

Get a monthly subscription of natural products and meditation equipments!
Check the front-end of this application here
Link of the API: https://gratibox-backend.herokuapp.com/

Technologies

How to use the API

POST /sign-up

With this route you can create a new user.

Send a JSON like this one:
{
  "name": "myUsername",
  "email": "myemail@gmail.com",
  "password": "12345678"
}

POST /sign-in

With this route you can sign-in into your account.

Send a JSON like this one:
{
  "email": "myemail@gmail.com",
  "password": "12345678"
}
This route will return a JSON like this one:
{
  "id": 1,
  "name": "myUsername",
  "token": "f7bccb16-cf91-4be8-94c1-b104273a0de7"
}

GET /subscription

With this route you can get the user's subscription.
This route needs a bearer token authorization.

This route will return a JSON like this one:
{
  "id": 1,
  "subscription_date": "2021-11-22T00:00:00.000Z",
  "plan": {
    "name": "Semanal",
    "delivery_day": "friday"
  },
  "delivery": {
    "name": "myUsername",
    "address": "Rua João Teodoro, 750, Brás",
    "zipcode": "01105000",
    "city": "São Paulo",
    "state": "SP"
  },
  "items": [
    "Chas",
    "Incensos"
  ]
}

POST /subscription

With this route you can get a new subscription.
This route needs a bearer token authorization.

Send a JSON like this one:
{
  "name": "myUsername",
  "dayId": 1,
  "items": [1, 2],
  "address": "Rua João Teodoro, 750, Brás",
  "zipcode": "01105000",
  "city": "São Paulo",
  "state": "SP",
}

How to run

Install the application

# Clone this repository
$ git clone https://github.com/gmtorres95/GratiBox-back

# Install the dependencies
$ npm i

Configure the .env file

Use the .env.example file

Run the application

$ npm run start