Restaurant Passport
As a foodie, I want to be able to always have ideas of where I can eat when the opportunity arises (date night, a rare free night, girls night, bachelor party, etc.). Iβm tired of defaulting to McDonalds because of decision fatigue every week! Iβm a goal setter, so I want to see visual progress of restaurants Iβve tried. I also want to brag to my friends about all the cool places Iβve been.
Users can signup and login. Include their name, city for their first passport, and email (can include other info you feel is needed).
npm i
|| yarn install
Installs project dependencies.
npm start
|| yarn start
Starts the server.
npm run dev
|| yarn dev
Starts the development server in watch mode.
npm test
|| yarn test
Runs all the test suites and displays test coverage.
- Navigate to client
cd client
and runnpm start || yarn start
The Restaurant Passport Backend code is hosted on Heroku and can be found here.
The following endpoints are available for use.
Methods | Endpoint | Description |
---|---|---|
GET | / | Returns the server status with a message |
GET | /api/v1/users | gets all users |
GET | /api/v1/users/:id | gets a user by id |
PUT | /api/v1/users/:id | update a user by id |
DELETE | /api/v1/users/:id | delete a user by id |
POST | /api/v1/auth/register | registers a new user |
POST | /api/v1/auth/login | logs a user in |
POST | /api/v1/blacklists/:userId/:restaurantID | blacklists a restaurant |
DELETE | /api/v1/blacklists/:id | removes a restaurant from the blacklist |
GET | /api/v1/blacklists/:userId | returns restaurants in the users blacklist |
GET | /api/v1/restaurants/ | returns all restaurants |
GET | /api/v1/restaurants/passport?city&&user | returns restaurants in the users city |
GET | /api/v1/restaurants/:id | returns a single restaurant with its reviews |
POST | /api/v1/restaurants | create a restaurant |
DELETE | /api/v1/restaurants/:id | deletes a restaurant |
PUT | /api/v1/restaurants/:id | updates a restaurant |
DELETE | /api/v1/reviews/:id | delete a review |
POST | /api/v1/reviews/:userId/:restaurantId | mark restaurant as visited |
GET | /api/v1/visits//:userId | get users visited restaurants |
DELETE | /api/v1/visits/:id | delete or remove restaurant as visited |
NOTE: Requests needing image uploads are handled from the frontend and the url returned from cloudinary is sent with the request
URL: https://restaurant-review-api.herokuapp.com/api/v1/auth/register
Payload:
{
"firstname": "Johnson",
"lastname": "Ogwuruu",
"email": "[email protected]",
"password": "test",
"city": "lagos"
}
Returns: A message that user has been added successfully.
{
"id": 11,
"firstname": "Johnson",
"lastname": "Ogwuruu",
"email": "[email protected]",
"password": "$2b$12$FT3lnf/qlO.mdxos5TflReEFIcgjuruv.qt2AJmldbW1KSbK55VrO",
"city": "lagos",
"role": "user",
"joined_at": "2019-08-02T09:34:06.809Z"
}
URL: https://restaurant-review-api.herokuapp.com/api/v1/auth/login
Payload:
{
"email": "[email protected]",
"password": "test"
}
Returns: An object with the token
{
"user": {
"id": 11,
"firstname": "Johnson",
"lastname": "Ogwuruu",
"email": "[email protected]",
"password": "$2b$12$FT3lnf/qlO.mdxos5TflReEFIcgjuruv.qt2AJmldbW1KSbK55VrO",
"city": "lagos",
"role": "user",
"joined_at": "2019-08-02T09:34:06.809Z"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjExLCJpYXQiOjE1NjQ3Mzg1NTcsImV4cCI6MTU2NDgyNDk1N30.lgb_dNNxxnIQp2CsGrhIYdHQve4d74a7ww-JQo4cg60"
}
URL: https://restaurant-review-api.herokuapp.com/api/v1/users/
Returns: An array of user object.
[
{
"id": 2,
"firstname": "Johnson",
"lastname": "Ogwuruu",
"email": "[email protected]",
"password": "$2b$12$dq3zwaupFhn4ZCbnrVY/SO2fsp.Sqktx./TpA34W/M543GscMxhD2",
"city": "lagos",
"role": "user",
"joined_at": "2019-07-30T23:54:50.994Z"
},
{
"id": 3,
"firstname": "Johnson",
"lastname": "Ogwuru",
"email": "[email protected]",
"password": "$2b$12$/ceFTr.GNsJ7aA0pHt7xL.GnQlNvIA38cs9dRYXo5cLdtuzWCt22i",
"city": "lagos",
"role": "user",
"joined_at": "2019-07-31T14:35:02.548Z"
},
{
"id": 4,
"firstname": "Johnson",
"lastname": "Ogwuru",
"email": "[email protected]",
"password": "$2b$12$3H8h9pnijikzv3sRH4xHDugyrzHkFgzUo8jQgIffSJG8jH7rtSWFi",
"city": "lagos",
"role": "user",
"joined_at": "2019-07-31T14:35:44.396Z"
},
{
"id": 5,
"firstname": "Johnson",
"lastname": "Ogwuru",
"email": "[email protected]",
"password": "$2b$12$RGDTlgWTcxZ6wpPXFPun/uTZ0FQRPl8taGcYtR49Z660ayEcXi5X2",
"city": "aba",
"role": "user",
"joined_at": "2019-07-31T14:46:42.179Z"
},
{
"id": 6,
"firstname": "Johnson",
"lastname": "Ogwuru",
"email": "[email protected]",
"password": "$2b$12$xKztd0fqAfHFfXrg67NwHOYosgEIDGuVXJXFdB48rsDhT72U/BzOW",
"city": "lagos",
"role": "user",
"joined_at": "2019-08-01T10:26:58.341Z"
},
{
"id": 7,
"firstname": "Johnson",
"lastname": "Ogwuru",
"email": "[email protected]",
"password": "$2b$12$YQKrtl7fikWBA9bxvhJ/VuQyDhwSLHdRkQhoVdad85QLjoy9Pn5KK",
"city": "lagos",
"role": "user",
"joined_at": "2019-08-01T10:27:56.328Z"
},
{
"id": 8,
"firstname": "Johnson",
"lastname": "Ogwuru",
"email": "[email protected]",
"password": "$2b$12$kuaokpmm5CRT2GYxjzODnOg5DnRJjAQxX8r9TXDVAxqrxqh/Kqr4.",
"city": "lagos",
"role": "user",
"joined_at": "2019-08-02T01:03:00.359Z"
},
{
"id": 9,
"firstname": "Johnson",
"lastname": "Ogwuru",
"email": "[email protected]",
"password": "$2b$12$oKwJcHq1Za2IQKEFt0ZvRO7eVSRFZZzRd0zDGJ1m5wfW1pxU2vvd2",
"city": "aba",
"role": "user",
"joined_at": "2019-08-02T01:03:57.253Z"
},
{
"id": 10,
"firstname": "Delba",
"lastname": "test",
"email": "[email protected]",
"password": "$2b$12$rIv6JxLn6kAx915li.ZheuHmp9.COG91wZqIA3uwiwgWnitJJPWuW",
"city": "newyork",
"role": "user",
"joined_at": "2019-08-02T07:18:09.847Z"
},
{
"id": 11,
"firstname": "Johnson",
"lastname": "Ogwuruu",
"email": "[email protected]",
"password": "$2b$12$FT3lnf/qlO.mdxos5TflReEFIcgjuruv.qt2AJmldbW1KSbK55VrO",
"city": "lagos",
"role": "user",
"joined_at": "2019-08-02T09:34:06.809Z"
}
]
URL: https://restaurant-review-api.herokuapp.com/api/v1/users/3
Returns: the user object.
{
"id": 3,
"firstname": "Johnson",
"lastname": "Ogwuru",
"email": "[email protected]",
"password": "$2b$12$/ceFTr.GNsJ7aA0pHt7xL.GnQlNvIA38cs9dRYXo5cLdtuzWCt22i",
"city": "lagos",
"role": "user",
"joined_at": "2019-07-31T14:35:02.548Z"
}
URL: https://restaurant-review-api.herokuapp.com/api/v1/restaurants
Returns: an array of restaurants
[
{
"id": 4,
"name": "iya tomi",
"description": "the best of them all",
"image": "https://res.cloudinary.com/ogwurujohnson/image/upload/v1561643304/bjc5fbdksvte293pnhdl.jpg",
"city": "lagos",
"no_of_reviews": "4",
"sum": "12",
"avgRating": 3
},
{
"id": 7,
"name": "Johnsonn",
"description": "jbjjlk",
"image": "https://res.cloudinary.com/ogwurujohnson/image/upload/v1561643304/bjc5fbdksvte293pnhdl.jpg",
"city": "lagos",
"no_of_reviews": "0",
"sum": null,
"avgRating": null
},
{
"id": 9,
"name": "Kelechi",
"description": "i dont have sense",
"image": "https://res.cloudinary.com/ogwurujohnson/image/upload/v1564707896/pnjzkouqqhdljbx9wdqo.jpg",
"city": "aba",
"no_of_reviews": "0",
"sum": null,
"avgRating": null
},
{
"id": 10,
"name": "Kelechi",
"description": "get sense u say no",
"image": "https://res.cloudinary.com/ogwurujohnson/image/upload/v1564707964/rsickofgtm8oztu7labj.jpg",
"city": "aba",
"no_of_reviews": "1",
"sum": "2",
"avgRating": 2
},
{
"id": 6,
"name": "Odogwu",
"description": "opens very late oo",
"image": "https://res.cloudinary.com/ogwurujohnson/image/upload/v1561643304/bjc5fbdksvte293pnhdl.jpg",
"city": "lagos",
"no_of_reviews": "1",
"sum": "2",
"avgRating": 2
},
{
"id": 12,
"name": "Wakkis Restaurant",
"description": "mnsbfadsmhfdjkhfdkbjmdjkmznsbma",
"image": "https://res.cloudinary.com/ogwurujohnson/image/upload/v1564730340/gqxxwy0nipunvqhfjmzz.jpg",
"city": "newyork",
"no_of_reviews": "1",
"sum": "3",
"avgRating": 3
},
{
"id": 3,
"name": "Iya Goodness",
"description": "The best restaurant in the whole of lekki",
"image": "null",
"city": "lagos",
"no_of_reviews": "1",
"sum": "3",
"avgRating": 3
},
{
"id": 1,
"name": "Junior High",
"description": "The best restaurant in the whole of lekki",
"image": "null",
"city": "lagos",
"no_of_reviews": "1",
"sum": "2",
"avgRating": 2
},
{
"id": 5,
"name": "Iya oge",
"description": "the best cook ever",
"image": "https://res.cloudinary.com/ogwurujohnson/image/upload/v1561643304/bjc5fbdksvte293pnhdl.jpg",
"city": "lagos",
"no_of_reviews": "2",
"sum": "9",
"avgRating": 4
},
{
"id": 2,
"name": "Mama Ebuka",
"description": "The best restaurant in the whole of lekki",
"image": "null",
"city": "enugu",
"no_of_reviews": "0",
"sum": null,
"avgRating": null
},
{
"id": 8,
"name": "Wakkis Restaurant",
"description": "Wakkis Food & Beverage Ltd is a registered company in Nigeria established to car.",
"image": "https://res.cloudinary.com/ogwurujohnson/image/upload/v1564702081/rnzpfg8tupzzkcbmiypq.jpg",
"city": "lagos",
"no_of_reviews": "0",
"sum": null,
"avgRating": null
},
{
"id": 11,
"name": "Kelechi",
"description": "get sense, no",
"image": "https://res.cloudinary.com/ogwurujohnson/image/upload/v1564708009/wbrgilu7qrg8kjunld3c.jpg",
"city": "aba",
"no_of_reviews": "0",
"sum": null,
"avgRating": null
}
]
URL: https://restaurant-review-api.herokuapp.com/api/v1/restaurants/1
Returns: The restaurant object with an array of reviews.
{
"id": 1,
"name": "Junior High",
"description": "The best restaurant in the whole of lekki",
"image": "null",
"city": "lagos",
"created_at": "2019-07-30T23:58:19.543Z",
"reviews": [
{
"id": 1,
"firstname": "Johnson",
"lastname": "Ogwuruu",
"ratings": 2,
"reviews": "Her rice is very bad"
}
]
}
URL: https://restaurant-review-api.herokuapp.com/api/v1/restaurants/passport?city=lagos&&user=4
Returns: Returns an array of restaurants.
[
{
"id": 3,
"name": "Iya Goodness",
"description": "The best restaurant in the whole of lekki",
"image": "null",
"city": "lagos",
"no_of_reviews": "1",
"sum": "3",
"avgRating": 3
},
{
"id": 8,
"name": "Wakkis Restaurant",
"description": "Wakkis Food & Beverage Ltd is a registered company in Nigeria established to car.",
"image": "https://res.cloudinary.com/ogwurujohnson/image/upload/v1564702081/rnzpfg8tupzzkcbmiypq.jpg",
"city": "lagos",
"no_of_reviews": "0",
"sum": null,
"avgRating": null
}
]
URL: https://one-line-daily.herokuapp.com/api/entries/17
Returns: Returns an entry object.
{
"status": 200,
"data": {
"id": 17,
"title": "file upload",
"text": "this uploads file to cloudinary",
"created_at": "2019-07-31T14:43:29.686Z",
"user_id": 2,
"image": {
"url": "http://res.cloudinary.com/dopxebhwn/image/upload/v1564584208/one_line_a_day/jspat0k0fjihpcqredrm.png"
}
}
}
URL: https://restaurant-review-api.herokuapp.com/api/v1/blacklists/4
Returns: An array of user's blacklist
[
{
"id": 4,
"name": "iya tomi",
"description": "the best of them all"
}
]
URL: https://restaurant-review-api.herokuapp.com/api/v1/visits/4
Returns: An array of user's visited restaurant
[
{
"id": 4,
"name": "iya tomi",
"description": "the best of them all"
}
]
The server uses the Jest testing framework to run tests.
Check tests with the npm test
command.
π» βοΈ Johnson Ogwuru π π€