University Proyect of TIP - UNQ
Number | Name | UNQ-Records | Position | |
---|---|---|---|---|
1 | Camila Cintioli | camila.cintioli@gmail.com | Developer | |
2 | Gabriel Pasquale | 33566 | pasqualeunq@gmail.com | Developer |
3 | Fernando Autalan | 38046 | f.n.autalan@gmail.com | Developer |
4 | Susana Rosito | rosito.susana@gmail.com | Tutora |
UNQuivalencias - documentación
Get the latest version of node from the official website or using nvm Nvm approach is preferred.
npm install
npm install -g sequelize sequelize-cli pg pg-hstore
Before running the app, make sure you have postgresql installed and a db created, to create it run the following steps inside a psql terminal:
- CREATE DATABASE db_project_name;
- CREATE DATABASE db_project_name_test;
- \c db_project_name
- CREATE ROLE "project_name" LOGIN CREATEDB PASSWORD 'project_name';
- grant all privileges on database db_project_name_test to project_name;
- ALTER DATABASE db_project_name_test OWNER TO project_name;
Then, set in .env
some variables:
DB_HOST=localhost
DB_PORT=5432
DB_NAME=db_project_name
DB_USERNAME=project_name
DB_PASSWORD=project_name
NODE_API_DB_NAME_TEST=db_project_name_test
Remember not to push nor commit the .env
file.
Finally, run in a terminal (proyect base):
- NODE_ENV=testing npm run create-db && NODE_ENV=testing npm run migrations
- npm run create-db && npm run migrations
To create a model with its migration, for example, run sequelize model:generate --name user --attributes name:string,password:string,age:integer
To create a migration, run sequelize migration:create --name="my-migration-name" --migrations-path ./migrations/migrations
.
To run them, execute npm run migrations
.
To create a seeder, run sequelize seed:create --name my-seed-file
.
To run them, execute npm run seed-db
.
Now, to start your app run npm start
in the rootpath of the project. Then access your app at localhost:port. The port is logged in the console where you ran the start script.
Now, to test your app run npm test
in the rootpath of the project.