Code Monkey home page Code Monkey logo

foodie-server's Introduction

๐ŸŒ FoodFire Server

A FoodFire Server (Node.js web server) that fetches data from a third-party (Swiggy) API (Fix the CORS Issue) and exposes it to a client ๐Ÿš€ FoodFire App ๐Ÿ˜.

๐Ÿ FoodFire App is part of Namaste React Live Course and Github Repository for this App is Namaste-React ๐Ÿ’œ ๏ธ

๐Ÿ”ฅ Clone this Repository

You need to write the following commands on the terminal screen(in vscode) so that you can run this project locally.

  git clone "https://github.com/chetannada/FoodFire-Server.git"

Go to the project directory

  cd FoodFire-Server

Install dependencies

  npm install

Start the server

  npm run start

This application should now be running on localhost. If you want to Fork repository and want to run locally, follow this guidelines Fork and Clone Github Repository

๐Ÿ’ซ Test the FoodFire Server Locally in your FoodFire React App then use this domain name (http://localhost:3000/) if the Server is running on a 3000 Port:

const response =  await fetch(`http://localhost:3000/api/restaurants?lat=12.9351929&lng=77.62448069999999&page_type=DESKTOP_WEB_LISTING`)

const data = await response.json();

๐Ÿ”ฎ Deploy the FoodFire server

Once you have tested the FoodFire server locally, you can deploy it to a production environment by following these steps.

  1. Create an account on Render if you haven't already.
  2. Click on the New + button and select Web Service from the dropdown menu.
  3. Connect to your own GitHub repository (node server that you have created your own) which you want to deploy.
  4. In the Settings tab, scroll down to the Environment Variables section and add PORT environment variables to 3000.
  5. Wait for the deployment to finish. Once it's done, you should see a success message and a link to our server URL. For Instance: http://YourOwnServerName.onrender.com
  6. Click on the link URL to test our server.

Note: Now that our server is deployed on Render you can change the API URL in react app to the domain in which the server is deployed. For instance: if your server is hosted in http://YourOwnServerName.onrender.com, in the react app while sending a request to API, use this domain name :

const response =  await fetch(`http://YourOwnServerName.onrender.com/api/restaurants?lat=12.9351929&lng=77.62448069999999&page_type=DESKTOP_WEB_LISTING`)

๐Ÿ”— Let's Connect

linkedin twitter discord

foodie-server's People

Contributors

rishishal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.