Coffee Shop locator
Welcome to the CoffeeShop Locator Demo!
make sure npm node js installed (this code was tested on node version 8.4.0)
Installation Instructions
- Clone this branch on your local (git clone https://github.com/divyesh86/coffee_shop_locator.git)
- cd into the directory where it was saved
- run command
npm install --save
- run command
npm run start-dev
- This should start the server on port 3001
Workflow (Use a different tab)
First Initialize (To load the data from locations.csv to memory)
Commands to test (Use a different tab)
-
Insert a new coffee shop curl -H "Content-Type: application/json" -X POST -d '{"name": "New Coffee Shop", "address":"990 Market St","latitude":"37.782394430549445", "longitude": "-122.40997343121123"}' http://localhost:3001/api/create
-
Read particular id curl http://localhost:3001/api/read/2
-
Update a coffee shop curl -H "Content-Type: application/json" -X POST -d '{"name": "New Coffee in SF", "address":"986 Market St","latitude":"37.782394430549445", "longitude": "-122.40997343121123"}' http://localhost:3001/api/update/3
-
Delete particular id curl -X POST http://localhost:3001/api/delete/3
-
Find the nearest coffee shop curl -H "Content-Type: application/json" -X POST -d '{"address":"990 Market St, San Francisco, CA, USA"}' http://localhost:3001/api/findNearest
Run tests
npm test