Skip to content

Cup-Of-JavaScript/javascript-express-api-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Express API Postgress

Assignments are located here.

Getting Started

  • 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

Creating a New API

  • 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 from api.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'); in api.js
    • Create postgres-pool.js file from postgres-pool.js.template
    • Create SQL in Postgres first
    • Create data access layer code
    • Create API endpoint
    • Create Thunder Client request

Notes

  • 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)

Videos

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5