Phantom is platform chich facilitate the transport into town, we track bus location, we assign the buses to drivers and operators.
- Get some stuffs on table
- Run
npm install - Create
.envin project root directory - Take a look at the
.env.examplefile which is in the project root directory to have a clue on environment variables that are being used in this project - Copy all keys from the
.env.examplefile to.envfile and add values to corresponding keys. These can be obtained from the project administrator - Feel free to add other keys and values according to your feature requirements
Note: Add keys in
.env.exampleto ease next setup for other developers.
- Time to serve
- For you to use your new environment variable you have to import
dotenvmodule in the file where you want to utilise your environment variables and configure it. like this:import dotenv from 'dotenv'; dotenv.config(); - Then you'll be able to access your environment variables via
process.env.YOUR_KEY - That's it, you're good to go!, happy coding!
- Configuring
.env- Download and install pgAdmin
- Create three databases, one for testing and another for development and other one for production.
- Copy
DEV_DATABASE_URL=postgres://postgres:yourpassword@yourhost:yourport/database-nameTEST_DATABASE_URL=postgres://postgres:yourpassword@yourhost:yourport/database-nameDATABASE_URL=postgres://postgres:yourpassword@yourhost:yourport/database-nameURLs from.env.exampleto.env - Edit them with your real database user, password and database name.
- Running Migrations
- Run
npm sequelize-cli db:migratein terminal to fire up migration
- Run
- Undoing Migrations
- Run
npm sequelize-cli db:migrate:undoto undo all migrations
- Running Seeds
- Run
npm sequelize-cli db:seed:allin terminal to run all seeds
- Undoing Seeds
- Run
npm sequelize-cli db:seed:undo:allin termninal to undo all seeds data from the database
- Run
npm run devin terminal
- Run
npm run testin terminal