Ensure you have the following installed on your local machine:
-
Make sure you have
nodejs,postgresinstalled. -
Clone or fork repo🤷♂
- git clone https://github.com/devcareer/Dae-Alright-Backend - cd Dae-Alright-Backend - npm install -
Create a PostgreSQL database by running the command below in
psqlcreatedb -h localhost -p 5432 -U postgres dae_dev
-
Create/configure
.envenvironment with your credentials. A sample.env.examplefile has been provided to get you started. Make a duplicate of.env.exampleand rename to.env, then configure your credentials. -
Run
npm run devto start the server and watch for changes.
Test specs are implemented using mocha & chai.
- To test or consume the API locally, you can make use of Postman to simulate a front-end client.
If you want to take the step below, first create a PostgreSQL database by running the command below in
psql.
createdb -h localhost -p 5432 -U postgres dae_test- There is also a test script that you can fire up by running
npm test.npm testperforms a single full test suite run, including code coverage reporting.
All API requests are made by sending a secure HTTPS request using one of the following methods, depending on the action being taken:
POSTCreate a resourceGETGet a resource or list of resourcesPATCHUpdate a resourceDELETEDelete a resource
For POST and PATCH requests, the body of your request may include a JSON payload.
Each response will be returned with one of the following HTTP status codes:
200OKThe request was successful400Bad RequestThere was a problem with the request (security, malformed)401UnauthorizedThe supplied API credentials are invalid403ForbiddenThe credentials provided do not have permissions to access the requested resource404Not FoundAn attempt was made to access a resource that does not exist in the API500Server ErrorAn error on the server occurred