Assignments are located here.
- Clone this repo
- Install dependencies:
npm install
- Create file:
postgres-pool.js
from file:postgres-pool.js.template
- Update
postgres-pool.js
with database password
- Update
- Prereq: Install nodemon only once:
npm install -g nodemon
- Create a new directory and
cd
into this directory, lauch VS code:code .
- Execute:
npm init -y
- Execute:
npm install express
- Execute:
npm install cors
- Create file:
api.js
fromapi.js.template
- Optionally change the port number in
api.js
(something greate than 1024):const PORT = 5152;
- Start the API:
nodemon api.js
- Test the "Hello World" message endpoint in Thunder Client:
GET http://localhost:5152/message
- Create new endpoint:
- Uncomment line 10:
const dataAccess = require('./data-access');
inapi.js
- Create
postgres-pool.js
file frompostgres-pool.js.template
- Create SQL in Postgres first
- Create data access layer code
- Create API endpoint
- Create Thunder Client request
- Uncomment line 10:
- api.js.template is a file that can be used to start building your Express API
- Be sure to run
create-bookstore-db.sql
in your student database (if you haven't already)