Address API
Start database in Docker
Start the MongoDB instance in a container.
npm run docker-start
Run tests
Run tests with test database.
npm test
Run API
Start the API and connect to production database.
npm start
API commands
Create an address
curl -d '{"name":"Steve", "street":"123 Apple Lane", "city": "Cupertino", "state":"CA", "country":"USA"}' -H "Content-type: application/json" -X POST http://localhost:8080/address
Get an address by id (id: object id)
curl http://localhost:8080/address/:id
Update an address (id: object id)
curl -d '{"name":"Steve", "street":"123 Apple Lane", "city": "Cupertino", "state":"CA", "country":"USA"}' -H "Content-type: application/json" -X PUT http://localhost:8080/address/:id
Delete an address (id: object id)
curl -X DELETE http://localhost:8080/address/:id
Get the list of addresses by {state | country} (country: 3 character ISO code, state: 2 character ISO code)
curl "http://localhost:8080/address?country=CTY&state=ST"
Stop Docker
Stop and remove the docker image after you finish testing.
npm run docker-stop