Run yarn in your terminal at the project root to install dependencies.
Create databases storefront and storefront_test in postgresql
Run yarn test for tests.
Run yarn watch to spin up the server on PORT 3000
Database port is 5432
Note that no mock data was added and tests are run in a precise order that creates the mock data.
- PGHOST
- PGUSER
- PGPASSWORD
- PGDATABASE
- PGDATABASETEST
- ENV
- SALTRE
- PEPPRE
- TOKEN_SECRET
This application uses the following libraries:
- Postgres for the database (node-postgres as interface)
- Node/Express for the application logic
- dotenv from npm for managing environment variables
- db-migrate from npm for migrations
- jsonwebtoken from npm for working with JWTs
- jasmine from npm for testing
In this repo there is a REQUIREMENTS.md document which outlines what this API needs to supply for the frontend, as well as the agreed upon data shapes to be passed between front and backend. This is much like a document you might come across in real life when building or extending an API.
Your first task is to read the requirements and update the document with the following:
-
RESTful route for each endpoint has been added to the
REQUIREMENTS.mddocument along with the HTTP verbs. -
Database schema has been added to the
REQUIREMENTS.mddocument taking note to account for various relationships.
Sensitive information has been hashed with bcrypt.
Create the models for each database table. The methods in each model map to the endpoints in REQUIREMENTS.md and were tested with Jasmine.
Route incoming requests to the correct model method. Endpoints created match up with the enpoints listed in REQUIREMENTS.md. Endpoints have tests and are CORS enabled.
JWT functionality has been added making sure that JWTs are required for the routes listed in REQUIUREMENTS.md.
Project spins up and run without errors.