Repository files navigation
structure
dependencies
boilerplate code
init npm package.json using npm init esm (for esm module support)
bring in dotenv and set up environment vars; use template .env file (DOTENV)
bring in http/https/express
add cors to http server
enable nodemon
set up folder structure and routers for root -> app -> api
placeholder routers for two generic entities (users, products)
data access layer: knex, sqlite3, pg, ... (install dependencies)
moved all http server code into server.js and cleaned up index to only launch the app.
enable persistent sessions using express-session and connect-session-knex
vars file
custom middleware - logger, errorHandler
Cascading Referential Integrity Constraints
used with foreign keys
NO ACTION - prevent delete/update; raise error (equivalent to RESTRICT on some db's)
CASCADE - cascade action down to dependencies
SET NULL - set dependent columns to null; column must be nullable for this to work
SET DEFAULT - set value to its default or null (assuming column is nullable) if no default defined for column
You can’t perform that action at this time.