Giter Site home page Giter Site logo

qs_node_api's Introduction

Quantified Self API

This is the API for the quantified self project that can be found at https://github.com/erose357/quantified-self

Endpoints

This API supports the following endpoints:

Food Endpoints:

  • GET /api/v1/foods - returns all foods currently in the database

  • GET /api/v1/foods/:id - returns the food object with the specific :id you've passed in or 404 if the food is not found

  • POST /api/v1/foods - allows creating a new food with the parameters: { food: { name: "Name of food here", calories: "Calories here"} } If food is successfully created, the food item will be returned. If the food is not successfully created, a 400 status code will be returned. Both name and calories are required fields.

  • PATCH /api/v1/foods/:id - allows one to update an existing food with the parameters: { food: { name: "Name of food here", calories: "Calories here"} } If food is successfully updated (name and calories are required fields), the food item will be returned. If the food is not successfully updated, a 400 status code will be returned.

  • DELETE /api/v1/foods/:id - will delete the food with the id passed in. If the food can't be found, a 404 will be returned.

Meal Endpoints

  • GET /api/v1/meals - returns all the meals in the database along with their associated foods

  • GET /api/v1/meals/:meal_id/foods - returns all the foods associated with the meal with an id specified by :meal_id or a 404 if the meal is not found

  • POST /api/v1/meals/:meal_id/foods/:id - adds the food with :id to the meal with :meal_id This creates a new record in the MealFoods table to establish the relationship between this food and meal. If the meal/food cannot be found, a 404 will be returned.

  • DELETE /api/v1/meals/:meal_id/foods/:id - removes the food with :id from the meal with :meal_id This deletes the existing record in the MealFoods table that creates the relationship between this food and meal. If the meal/food cannot be found, a 404 will be returned.

Setup

The site is hosted on heroku and can be found at https://qs-node-api.herokuapp.com/

You can clone the repo by following these steps:

git clone [email protected]:blsrofe/qs_node_api.git
cd quantified-self
npm install

You can run the program by entering

npm start

Contributions

To contribute to this app fork and download then submit a PR to this repository.

Collaborators

Eddie Rose - @erose357

Becki Srofe - @blsrofe

qs_node_api's People

Contributors

erose357 avatar blsrofe avatar

Forkers

erose357

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.