takehome-addresses is a an example REST API developed with Docker, Node.js, PostgreSQL, and Knex.js.
See Test Driven Development with Node, Postgres, and Knex (Red/Green/Refactor) by Michael Herman for details.
Dockerized with the help of Bret Fisher's node-docker-good-defaults.
Modified by Max Howard for a special use case.
- You'll need Docker and docker-compose.
$ git clone [email protected]:Astrovicis/takehome.git && cd takehome
- Build Docker containers locally:
$ docker-compose up -d --build
- Run migrations & seed:
$ docker-compose exec node_app knex migrate:latest --env development
$ docker-compose exec node_app knex migrate:latest --env test
$ docker-compose exec node_app knex seed:run --env development
$ docker-compose exec node_app knex seed:run --env test
docker-compose up -d
Go to http://localhost
to see the Express app.
After you've spun up the container:
docker-compose exec node_app mocha --exit
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
- Docker compose is really useful
- Null prototype objects should be null prototype objects as the req.body
- Joi is great and I miss it
- Add Joi validation
- Change db/queries.js to services/addresses.js
- Make more secure the postgres container (nondefault passwords), especially with open port
- De-hardcode the table columns queried by getMatching, whether with objection or knex