A user can search for a restaurant based on location, cuisine, or restaurant’s name and visit the restaurant’s page to get an overview of what the restaurant has to offer like photos of their dishes, their menu options, customers’ reviews, and be able to make a reservation.
- Reservation: https://github.com/freeseats/wfong-service-reservations
- Top-Bar: https://github.com/freeseats/exzerone-search-bar
- Menu, Related Restaurants, Side-Bar: https://github.com/freeseats/Menu-Related-SideBar
- Restaurant Photos: https://github.com/freeseats/matthewjdiaz1-photo-service
- Reviews: https://github.com/freeseats/slhodak-reviews-and-impressions
An nvmrc
file is included if using nvm.
- Node 6.13.0
- etc
- Before seeding, make sure to npm install
- Log into mySQL from terminal: mySQL -u root -p
- Enter password if set up with one
- If 'reservations' database exists in mySQL: drop database reservations;
- Create database in mySQL: create database reservations;
- Select database: use reservations;
- Go to db/db.js to change your user and password on line 4
- Run script: npm run seed
- To check 'reservations' database: select * from restaurants;
From within the root directory:
npm install
npm run build
npm start
- In a broswer, go to: localhost:3020
Method | URL | Operation |
---|---|---|
GET | '/:id/bookings' | Retrieves the data |
POST | '/bookings' | |
PUT | '/:id/bookings' | |
DELETE | '/:id/bookings' |
/bookings
POST
none
POST will have a JSON.stringified object containing the info needed to book a restaurant which includes: the restaurant id, the reservation date, the time slot, and the party size.
Code: 201 Created
Code: 500 INTERNAL SERVER ERROR Content: { 'Could not create reservation' }
$.ajax({ url: "/:id/bookings", dataType: "json", type : "POST", success : (err, results) => { if (err) { console.log(err); } else { this.setState({ bookings: res.data.booked, resName: res.data.name, allData: res.data, }); } } });
/:id/bookings
GET
id=[interger]
GET will have an id on its body payload
Code: 200 OK
Code: 404 NOT FOUND Content: { 'unable to retrieve from db: ', err) }
$.ajax({ url: "/:id/bookings", dataType: "json", type : "GET", success : (err, results) => { if (err) { console.log(err); } else { this.setState({ bookings: res.data.booked, resName: res.data.name, allData: res.data, }); } } });
/:id/bookings
PUT
id=[interger]
PUT will have an id on its body payload and a JSON.stringified object of the info which needs to be updated which could include any of: the restaurant id, the reservation date, the time slot, and the party size
Code: 202 ACCEPTED
Code: 500 INTERNAL SERVER ERROR Content: { 'Could not update reservation' }
$.ajax({ url: "/:id/bookings", dataType: "json", data: {containg properties and values that need to be updated}, contentType: json, type : "PUT", success : (err, results) => { if (err) { console.log(err); } else { this.setState({ bookings: res.data.booked, resName: res.data.name, allData: res.data, }); } } });
/:id/bookings
DELETE
id=[interger]
DELETE will have an id on its body payload
Code: 202 ACCEPTED
Code: 500 INTERNAL SERVER ERROR Content: { 'Could not delete reservation' }
$.ajax({ url: "/:id/bookings", dataType: "json", type : "DELETE", success : (err, results) => { if (err) { console.log(err); } else { this.setState({ bookings: res.data.booked, resName: res.data.name, allData: res.data, }); } } });