The backend of Dueet-Live!
npm install
Start the Postgres server and create a database called dueet-live
(or any name you like).
Sample SQL command:
CREATE DATABASE "dueet-live";
First, create a .env
file from the template.
cp .env.example .env
Then, modify .env
to change the configuration options. In particular, you might need to change the database URL.
Remember to use the database name that you created in the previous step.
Seed the database with initial songs and genres by running
npm run build
npm run seed
Run the following 3 commands in 3 different terminal windows.
npm run watch:build
npm run watch:rest
npm run watch:ws
This will let nodemon
observe file changes and automatically recompile the server as you modify the files.
To drop the database, run
npm run db:drop
To synchronise the database schema with the entities in the source code, run
npm run db:sync
Remember to re-seed after you re-create the database.
To drop, sync, and then reseed the database, run
npm run reseed
You might also be interested in other npm
scripts. Take a look at package.json
.
The database schema is set to automatically update whenever the entities change. When this happens, all the pre-existing data is lost.