Skip to content

Rest API built with Fastify and TypeScript, utilizing various libraries for testing, database management, and environment variable handling.

License

Notifications You must be signed in to change notification settings

brunod-e/daily-diet-api

Repository files navigation


Logo

Daily Diet API

Rest API for a daily diet application

Report Bug . Request Feature

Contributors Issues License

Table Of Contents

About The Project

Screen Shot

This project is the backend API for a daily diet application, providing functionality related to user authentication, data storage, and retrieval for managing daily dietary information.

Built With

This API is built with Fastify and TypeScript, utilizing various libraries for testing, database management, and environment variable handling. It's designed to support a daily diet application, providing a reliable and performant backend for managing user data related to dietary habits.Here are a few examples.

Getting Started

This project is available at: https://daily-diet-api-r1k9.onrender.com/

Prerequisites

  • npm
npm install npm@latest -g

Installation

  1. Clone the repo
git clone https://github.com/brunod-e/daily-diet-api
  1. Install NPM packages
npm install
  1. Configure your .env
DATABASE_URL="./db/app.db"
DATABASE_CLIENT="sqlite"
NODE_ENV="development"
  1. Run migrations
npm run dev-knex -- migrate:latest
  1. Run server
npm run dev
  1. Run tests
npm test

Usage

POST /users

Descrição: Rota para criar um usuário. Parâmetros: name(string): Nome do usuário. email (string): Email do usuário.

GET /meals

Descrição: Obter todas as refeições registradas.

POST /meals

Descrição: Adicionar uma nova refeição ao usuário. Parâmetros: name (string): Nome da refeição. description (string): Descrição da refeição. isOnDiet (boolean): Se está ou não incluso na dieta. date (string): Data que foi feita a refeição.

GET /meals/:id

Descrição: Obter uma refeição específica. Parâmetros: id (string): Identificador único da refeição.

PUT /meals/:id

Descrição: Atualiza uma refeição. Parâmetros: id (string): Identificador único da refeição. name (string): Nome da refeição. description (string): Descrição da refeição. isOnDiet (boolean): Se está ou não incluso na dieta. date (string): Data que foi feita a refeição.

DELETE /meals/:id

Descrição: Apaga uma refeição. Parâmetros: id (string): Identificador único da refeição.

GET /meals/metrics

Descrição: Retorna os dados relacionados a todas as refeições feitas pelo usuário.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  • If you have suggestions for adding or removing projects, feel free to open an issue to discuss it, or directly create a pull request after you edit the README.md file with necessary changes.
  • Please make sure you check your spelling and grammar.
  • Create individual PR for each suggestion.

Creating A Pull Request

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

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

Authors

  • Bruno D. - Fullstack Developer - Bruno D. - Built full application

Acknowledgements

About

Rest API built with Fastify and TypeScript, utilizing various libraries for testing, database management, and environment variable handling.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published