Example of using pg-copy-streams
to seed a postgres database with a file.
(https://www.npmjs.com/package/pg-copy-streams)
- node, npm
- psql cli
- local postgres database (with database
mydb
as defined in package.json, and tablemytable
as defined in schema.sql)
- add your
dbcreds.js
file matching the sample. npm run clear
to clear the db.npm run seed
to seed the db.npm start
to start server.- visit
localhost:3000
in browser to see the seeded db rows (or inspect the db through cli).