Giter Club home page Giter Club logo

r2-tech-test's Introduction

README - Lizzo’s Juicy Juice Bar - The Server

Version 1.0 coded by Szymon Orchowski

Requirements:

Node - v16.14.0
PostgreSQL - 13.4

Coded and tested only for happypath so far. Error handling controllers, and test need to be implemented.

Server is prepared for hosting and works on test, development, and production databases.

Instructions:

Install all dependencies

npm i

Create enviromental files:

.env.dev
.env.test

and they should look like following lines:

PGDATABASE=juicy_juice_bar_database

PGDATABASE=juicy_juice_bar_database

setup a database:

npm run setup-dbs

Now you can run a test suite:

npm run test

Or you can seed a data to database by running following script and test the server in e.g Insomnia on local port: 9090

npm run seed

Endpoints:

/api/recipes

GET - return all recipes from the database

it takes query of "exclude_ingredients" to exclude recipes that has certain ingredients (separated by commas) example:

/api/recipes?exclude_ingredients=bananas,strawberries,coffee,milk,oat milk,apple juice

POST - you can add a recipe to the database

request should include a JSON object that looks exactly like following example:

{
  "imageUrl": "http://www.images.com/13456734567",
  "instructions": "instructions",
  "ingredients": [
    { "name": "ingredient1", "grams": 25},
    { "name": "ingredient2", "grams": 66},
    { "name": "ingredient3", "grams": 44},
    { "name": "ingredient4", "grams": 198}
  ]
}

/api/recipes/:id

GET - return a single recipe of a given id from the database

r2-tech-test's People

Contributors

sssam-c avatar szymonorchowski 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.