<%= i.name %>
38 |<%= i.address %>
40 |
Average Cost For Two: | 43 |<%= i.average_cost_for_two %> | 44 |
Price Range: | 47 |<%= i.price_range %> | 48 |
Has Online Delivery: | 51 |<%= i.has_online_delivery %> | 52 |
Cuisines: | 55 |<%= i.cuisines %> | 56 |
59 | |
├── .gitignore
├── LICENSE
├── README.md
├── package.json
├── views
├── search.css
├── search.html
├── zomato.css
└── zomato.ejs
└── zomato.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 |
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 anandpatel
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Zomato-API
2 |
3 | In this project, I have used Zomato-API (https://developers.zomato.com/) to get the details of restaurants present in a particular location. You'll be asked a location to fetch the details like **average cost for two people, price ranges, has online delivery or not, and cuisines** of that location.
4 |
5 | ## Requirements
6 |
7 | ### NodeJS and npm
8 |
9 | If you're using Linux-based OS, install the latest version of Nodejs and npm, by typing the following commands on your terminal.
10 | ```
11 | sudo apt update
12 | sudo apt install build-essential apt-transport-https lsb-release ca-certificates curl
13 |
14 | ```
15 |
16 | Then, for the **Latest** release (version 12), add this PPA, by typing the following command on your terminal
17 | ```
18 | curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
19 | sudo apt install nodejs
20 | ```
21 |
22 | Now, you need to install necessary dependencies using npm (node-package-manager), open your termial, and first type
23 | `npm init` to initialize **package.json** file. Then, type
24 | ```
25 | npm install body-parser ejs express iplocation path public-ip zomato --save
26 | ```
27 |
28 | ### How to Run?
29 |
30 | Now, navigate to `server.js` file on your terminal, and run the following command to start your localhost server
31 | ```
32 | node server.js
33 | ```
34 |
35 | ### Endpoints
36 |
37 | - **/categories**
38 | - This endpoint presents you a list of all restaurants categorized under a particular restaurant type.
39 |
40 | - **/geocode**
41 | - This endpoint takes **latitude and longitude** to get the list of popular Cuisines, Foodie, Nightlife-index and nearby restaurants using your public IP address.
42 |
43 | - **/search**
44 | - This endpoint takes a location, and gives you the precise restaurant suggestions, using `/geocode` endpoint.
45 |
46 | Now, open your browser, and type
47 | http://localhost:{PORT}/{YOUR_ENDPOINT} to get the required details.
48 |
49 | Happy coding ):
50 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "zomato",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "zomato_api.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "anand",
10 | "license": "MIT",
11 | "dependencies": {
12 | "ejs": "^2.6.2",
13 | "express": "^4.17.1",
14 | "zomato": "^1.1.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/views/search.css:
--------------------------------------------------------------------------------
1 | body{
2 | background-image: url('https://www.xmple.com/wallpaper/gradient-linear-red-grey-1920x1080-c2-ff0000-778899-a-15-f-14.svg');
3 | background-size: cover;
4 | background-attachment: fixed;
5 | }
6 | .center_div{
7 | padding: 11vw;
8 | margin-left: 10vw;
9 | margin-right: 10vw;
10 | /*background-color: white;*/
11 | background: rgba(171, 205, 239, 0.3)
12 | }
13 | * {
14 | box-sizing: border-box;
15 | }
16 |
17 | form.example input[type=text] {
18 | padding: 10px;
19 | font-size: 17px;
20 | border: 1px solid grey;
21 | float: left;
22 | width: 80%;
23 | background: #f1f1f1;
24 | }
25 | form.example button {
26 | float: left;
27 | width: 20%;
28 | padding: 10px;
29 | background: #2196F3;
30 | color: white;
31 | font-size: 17px;
32 | border: 1px solid grey;
33 | border-left: none;
34 | cursor: pointer;
35 | }
36 | form.example button:hover {
37 | background: #0b7dda;
38 | }
39 |
40 | form.example::after {
41 | content: "";
42 | clear: both;
43 | display: table;
44 | }
45 | .place{
46 | margin-left: 18vw;
47 | }
48 | @media only screen and (max-width: 1125px) {
49 | .tab{
50 | padding: 20vw;
51 | }
52 | .place{
53 | margin-left: 14vw;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/views/search.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
<%= i.address %>
Average Cost For Two: | 43 |<%= i.average_cost_for_two %> | 44 |
Price Range: | 47 |<%= i.price_range %> | 48 |
Has Online Delivery: | 51 |<%= i.has_online_delivery %> | 52 |
Cuisines: | 55 |<%= i.cuisines %> | 56 |
59 | |