Clone the repository and run the following command under your project root:
npm install
After that create an .env
file under the project root directory and paste the following information:
DB_USER=
DB_PASS=
DB_HOST=
DB=
NODE_ENV=development
BLUEBIRD_WARNINGS=1
BLUEBIRD_W_FORGOTTEN_RETURN=0
SENDGRID_API_KEY=testing123
SENDGRID_API_USER=puntoverdedev
For development enviroment we are using postgresql. You will have to download and create a local db and then put your credentials on
.env
file. and also on theknexfile.js
file.
On the knexfile.js
you must change this information with your local enviroment's information.
development: {
client: 'postgresql',
connection: {
host: process.env.DB_HOST ||'127.0.0.1',
database: process.env.DB ||'localDb',
user: process.env.DB_USER || 'localUser',
password: process.env.DB_PASS || 'localPassword'
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'migrations'
}
},
Now that we have our enviroment set up we just need to run the migrations and the seeds:
You may have to install knexJs globally.
npm install knex -g
knex migrate:latest
knex seed:run
You will need to have installed heroku cli. Then just run:
heroku local
and the server will start on localhost:5000
Since this is an API we can test all the features with postman.
We have local auth with JWT. In order to get the endpoints working we need a user token.
First we need to make a POST request to
http://localhost:5000/v1/users
with a name
, email
and password
fields fulfilled.
After that we just make another POST request to
http://localhost:5000/v1/auth/signin
with the same name
and password
values and we'll get a TOKEN.
After that we just set the Authorization
header
Bearer <YOUR_TOKEN_HERE>
and we'll be able to acces to all endpoints.
All enpoints are under /v1/ prefix and are RESTful
Custom resources
* /users
* /sectors
* /neighborhoods
* /scraps
Authentication
* /auth/signup // -> signup users
* /auth/signin // -> signin users
* /auth/forgot // -> forgot password email handler
* /auth/reset/:token // -> reset password handler