Skip to content

GatCode/OpenFoodBase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

nutritional facts without restrictions



gitter docs items license

About

OpenFoodBase is a free and open source database which contains nutritional facts on food. The live database can be found here.

Getting Started

Creating and searching food in the database can be done with a set of API calls.

Detailed information about the different API calls can be found here. Please use this API calls with respect to the OpenFoodBase project and to other users! Please do not insert wrong informartion! If you made a mistake, please contact me!

Here are a few example calls:

πŸ“Š List all food items in the database

(by default the number of food items is limited to 20)

Perform a GET request to:

https://openfoodbase.herokuapp.com/search/food/all

this leads to the following result (truncated):

[
  {
    "_id": "5c25006c21e4dfd83dc151c3",
    "name": "Apple",
    "serving": "100g",
    "calories": 54,
    "protein": 0.3,
    "carbs": 14.3,
    "fat": 0.1,
    "barcode": 123123123,
    "image": "putyourimageurlhere",
    "__v": 0
  },

πŸ›  Create a new food item

Perform a POST request with the body:

{
	"name": "Apple",
	"serving": "100g",
	"calories": 54,
	"protein": 0.3,
	"carbs": 14.3,
	"fat": 0.1
}

to:

https://openfoodbase.herokuapp.com/create/food

Run API locally

πŸ”Œ Installation and Start

If you wish to run the API on your local machine, use the following instructions.

Make sure to have Node installed on your system and navigate to the src directory.

cd src

run:

npm install

to start the Node server:

npm run dev

Congratulations, you are now running OpenFoodBase on localhost:3000! Enjoy πŸŽ‰

Limitations

Please feel free to adapt it to your needs. I would be very grateful to include your inprovements. Thanks for your support!

About

🍳 Open Source Food Database

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published