- Clone this repository to your local machine
- Install the dependencies for the project:
npm install
- If there are high vulnerabilities reported during the install:
npm audit fix --force
- Ensure your PostgreSQL server is running
- on a Mac:
pg_ctl restart
- on a Windows (example bellow is for PostgreSQL 13):
pg_ctl.exe restart -D "C:\Program Files\PostgreSQL\13\data"
- on a Mac:
- Create a User for this project:
createuser testuser
- Create a database for the project with your user as the owner:
createdb testdb
- Grant all privileges for the new database
psql testdb
alter user testuser with encrypted password 'qwerty'; grant all privileges on database testdb to testuser;
- Rename the
example.env
file to.env
and update the following fields with your database credentials:MIGRATION_DB_NAME= MIGRATION_DB_USER= MIGRATION_DB_PASS= DB_URL="postgresql://USERNAME@localhost/DATABASE_NAME"
- Create the database tables:
npm run migrate -- 1
- Start the tests:
npm t
- You should see output from 10 integration tests, all passing.
- To install the node project ===> npm install
- To fix vulnerabilities after installation ===> npm audit fix --force
- To migrate the database ===> npm run migrate -- 1
- To run Node server (on port 8000) ===> npm run dev
- To run tests ===> npm run test
- migration folder contains all the sql files necesay for the DB setup
- public folder contains the View related files
- src folder contains the Controller related files
-
server.js is the entry point of the Controller logic (where all the general app settings live)
-
app.js is the starting pint for the routes
-
pancake folder contains the router with all the pancake API endpoints
- pancake-router.js Pancake Router
- GET Endpoint: Add a GET endpoint to this server
- POST Endpoint: Add a POST endpoint to this server
- DELETE Endpoint: Add a Delete endpoint to this server
- PATCH Endpoint: Add a PATCH Endpoint to this server
- pancake-service.js Service file for the Controller connection witht the Model
- pancake-router.js Pancake Router
-
middleware folder contains functions that are used by the controller in multiple places
-
- test folder contains the Test files