/recipe-server

A NodeJS, Express, and MongoDB REST API to deliver recipes scraped with Recipe Scraper

Primary LanguageTypeScript

recipe server

A NodeJS, Express and MongoDB REST API to deliver recipes scraped with Recipe Scraper


Installation

Run the following script in your terminal, it will create a folder containing the script and install dependencies.

git clone --depth=50 --branch=main https://github.com/heyiamZer0/recipe-server.git heyiamZer0/recipe-server recipe-server && cd heyiamZer0/recipe-scraper && yarn

create your .env file:

vim .env

press i to start insert mode and define your enviroment variables:

  • URI = mongodb+srv://databaseMongo:PASSWORD@cluster0.mongodb.net/DATABASE?retryWrites=true&w=majority
  • PORT = <#PORT to run the server at>
  • DB_NAME = MONGO_DATABASE_NAME
  • DB_COLLECTION = MONGO_DATABASE_COLLECTION

to exit and save, hit esc and :wq

Start the server

yarn devTS

Usage

Example for GET /id with ID 1234 on the local database using the recipes scraped with Recipe Scraper will return:

{ 
    _id: 1234
    title: String
    image: String
    ingredients: [{
        ingredient: String
        quantity: String
    }]
    description: [{
        step: Number
        instructions: String
    }]
    calories: null || Number
    category: String
    difficulty: String
    time: Number
}

Built With

Related projects

License

Distributed under the MIT License. See LICENSE for more information.