The backend of Dueet-Live!
npm installStart 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 .envThen, 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 seedRun the following 3 commands in 3 different terminal windows.
npm run watch:build
npm run watch:rest
npm run watch:wsThis will let nodemon observe file changes and automatically recompile the server as you modify the files.
To drop the database, run
npm run db:dropTo synchronise the database schema with the entities in the source code, run
npm run db:syncRemember to re-seed after you re-create the database.
To drop, sync, and then reseed the database, run
npm run reseedYou 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.
