https://github.com/hhimanshu/contactz
A NodeJS based RESTful API server with Database Migrations
https://github.com/hhimanshu/contactz
docker expressjs nodejs postgresql sequelize-orm
Last synced: 2 months ago
JSON representation
A NodeJS based RESTful API server with Database Migrations
- Host: GitHub
- URL: https://github.com/hhimanshu/contactz
- Owner: hhimanshu
- License: mit
- Created: 2017-09-22T21:49:25.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-02T02:00:03.000Z (over 8 years ago)
- Last Synced: 2025-07-22T17:22:56.773Z (11 months ago)
- Topics: docker, expressjs, nodejs, postgresql, sequelize-orm
- Language: JavaScript
- Homepage:
- Size: 353 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Contactzz [](https://travis-ci.org/hhimanshu/contactz)
[](https://heroku.com/deploy)
### Technologies used
- NodeJS
- ExpressJS
- Sequelize (for DB Migrations)
- Docker (for PostgreSQL container) or SQLite (for no database installation. This is default mode)
### Pre-requisites
- Install NodeJS
- Install Docker (or PostgreSQL on your machine)
### Setup PostgreSQL container
```bash
docker run --name contact-db -e POSTGRES_PASSWORD=contactdb -d postgres
```
To access PostgreSQL
```bash
docker exec -it contact-db bash
psql -U postgres -W
(enter password as contactdb)
```
### How to run
Checkout the codebase
```bash
git checkout https://github.com/hhimanshu/contactz
cd contactz
```
Install Dependencies
```bash
npm install
```
Run the DB migrations (local - PostgreSQL)
```bash
node_modules/.bin/sequelize db:create
node_modules/.bin/sequelize db:migrate
node_modules/.bin/sequelize db:seed:all
```
Run the DB migrations (local - SQLite)
```bash
# if you want to start from scratch
rm -rf db.development.sqlite;
# run regardless
node_modules/.bin/sequelize db:migrate; node_modules/.bin/sequelize db:seed:all
```
Run the DB migrations (Heroku)
```bash
heroku run sequelize db:migrate --app contactzz
heroku run sequelize db:seed:all --app contactzz
```
Run the application locally
```bash
npm run dev
```
Access the application at http://localhost:3000
### Access Heroku APIs
https://contactzz.herokuapp.com/
https://contactzz.herokuapp.com/users
https://contactzz.herokuapp.com/contacts
### References
The following links were found useful when creating this application
https://github.com/babel/example-node-server
https://www.lookami.com/using-es6-es2015-in-a-node-js-express/
https://github.com/vmasto/express-babel
http://docs.sequelizejs.com/manual/tutorial/migrations.html
https://github.com/sequelize/sequelize
https://hub.docker.com/_/postgres/
https://github.com/sequelize/express-example
https://stackoverflow.com/questions/27687546/cant-connect-to-heroku-postgresql-database-from-local-node-app-with-sequelize
https://medium.com/@KerrySheldon/deploying-a-node-app-and-importing-a-postgres-database-to-heroku-8ad7bc9a2639
https://devcenter.heroku.com/changelog-items/438 (URL Construction scheme)
https://stackoverflow.com/questions/22633618/sequelize-migrations-in-heroku
http://andyfiedler.com/2016/02/getting-jetbrains-datagrip-to-work-with-heroku-postgres
https://stackoverflow.com/questions/22604644/jasmine-async-callback-was-not-invoked-within-timeout-specified-by-jasmine-defa
https://volaresystems.com/blog/post/2014/12/09/Testing-async-calls-with-Jasmine
https://github.com/Automattic/expect.js?files=1
https://www.npmjs.com/package/supertest
https://stackoverflow.com/questions/19041837/difference-between-res-send-and-res-json-in-express-js