This is the server behind the All-Gender Bathroom Finder App.
Functionality of the server includes:
- GET all bathroom locations.
- GET bathroom locations based on geography.
- GET bathroom locations based on query.
- POST new bathroom locations, with checks for unique locations.
- DELETE bathroom locations by ID.
- PUT bathroom locations by ID
-
Install MongoDB locally on your machine. https://zellwk.com/blog/install-mongodb/
-
Set up the database
mongoexport -h ds163053.mlab.com:63053 -d bathroom-finder -c locations -u admin2 -p password1 -o ~/db/data
mongoimport --db bathroom-finder --collection locations --drop --file ~/db/data
-
run mongod
-
run npm run dev
-
npm install
Base URL: https://gentle-lake-28954.herokuapp.com/api
/locations
Returns all locations.
/locations/geography?lat=VALUE&lng=VALUE
Returns all locations based on latitude and longitude.
/locations/search?query
Returns locations by query.
/locations/id/:id
Returns locations by ID.
/locations
Posts new location to the server. First searches server based on location name and zipcode to check for unique values.
/locations/:id
Edits & returuns location
/locations/:id
Deletes location
{ "_id": "5c32bc8ccdfffe0017336520", "loc": { "type": "Point", "coordinates": [ -78.9577334, 36.0403879 ] }, "type": [ "restaurant", "point_of_interest", "food", "establishment" ], "googlePlaceId": [ "ChIJ24c6XRHhrIkRA18898mTQ6Y" ], "name": "Picnic", "street": "1647 Cole Mill Road", "city": "Durham", "state": "NC", "zip": "27705", "dist": { "calculated": 0 } }
_id: Generated by server when location is created
loc: Location object for Mongoose. Type is always Point. Coordinates MUST be longitude first, latitude second.
type: Array pulled from Google Places API.
googlePlaceId: ID for Google Places API.
name: Name of location.
street: Street Address.
city: City
state: State.
zip: Zipcode (String)
dist: Returned from /locations/geography endpoint. Distance in meters from queried location.
This server was created using the following technologies:
- Node.js
- Express
- MongoDB
- Mongoose
- Mocha/Chai Testing
- Travis CI
This project was created by Alex Manzo.