Assignment Database System - Transport Passenger
Assignment Database System - Transport Passenger System
NodeJS, Sequelize (Postgres SQL), ReactJS, Express.JS, Heroku (App, Postgre), AWS (EC2, S3)
Web Store
Octotree
and install the extension on Chromepackage.json
: should view script
to useindex.js
: start running node with babel
(transform ES6, ES7 to ES5) and dotenv
(environment variables)server.js
: start server expresstest.js
: only for testing somethingsconfig/db.js
: export environment variables for databaseserver/config/sequelize
: config package sequelize
server/models
: Define models schema of sequelizeserver/controllers
: Controllers connect to databaseserver/routes
: Routes expressserver/documents
: Database diagrams ERDserver/scripts
: Import SQL, database scripts
clear
: truncate tablescreate
: create tablesdrop
: drop all tablesfake
: fake data on your databaseadmin-portal
: front-end with ReactJSgit clone https://github.com/huynhsamha/transport-passenger.git
Create .env
in root project (the file is ignored in .gitignore
, because of security for production)
This project use Postgres SQL.
The file as similar for development:
DB_HOST=localhost
DB_PORT=5432
DB_NAME=transport_passenger
DB_USERNAME=example_username
DB_PASSWORD=example_password
See file config/db.js
that use the file to export configure the database.
# use npm
npm install
# or can use yarn
yarn
Install postgres
(database) and pgAdmin 3
(tool development)
To drop all table in your schema (default of postres is public
schema):
yarn run db:drop
To create tables:
yarn run db:create
To clear data of tables (only clear data, sequences not reset):
yarn run db:clear
After run db:create
, you can fake data or import available data by following options:
To fake data (maybe catch error):
yarn run db:fake
To import data:
Open pgAdmin 3
and run script file scripts/import-data.sql
Before start NodeJS, use Oracle SQL Developer or other ways to open localhost and port for database you use for the project.
After above step, run:
# use npm
npm start
# or can use npm
yarn start
Add your test files anywhere in server
or test
directory with *.spec.js
Run testing:
# use npm
npm run test
# or can use yarn
yarn test
The project uses husky
for pre-commit code, that lints your code (eslint
) and detect your bug syntax js before commit or push.
In file .env
, add
# example for domain
DOMAIN=https://domain.com
# example for session secret
SESSION_SECRET=emCNrg59au2fvhgr5RA9TBxvWyBhPRw2RdjZAXR79v5JfDAKMX
# email for project
EMAIL_ADDRESS=noreply.transport.passenger@gmail.com
EMAIL_PASSWORD=[contact someone who know password]
# amazon aws
AWS_ACCESS_KEY_ID=[your access key aws]
AWS_SECRET_ACCESS_KEY=[your secret access key aws]
AWS_S3_BUCKET=transport-passenger
View APIs here
View Documents here
View instructions here
View instructions here