src: https://github.com/mariusbanea/thinkful-node-postgres-boilerplate-app
git clone BOILERPLATE-URL NEW-PROJECTS-NAME && cd $_
to clone this repository to your local machine and change directory.rm -rf .git && git init
to make a fresh start of the git history for this project with (git remote -v
to confirm).- Install the dependencies for the project (
npm install
) - If there are high vulnerabilities reported during the install, run (
npm audit fix --force
) - Ensure your PostgreSQL server is running
- Create a User for this project
- Create a database for the project with your user as the owner
- 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"
- Run the command
npm run migrate -- 1
to create the database tables - run the command
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