Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raulpe7eira/food-diary
ignite - module: elixir and graphql with absinthe from rocketseat by Rafael Camarda
https://github.com/raulpe7eira/food-diary
absinthe ecto elixir graphql ignite phoenix postgresql rocketseat
Last synced: about 2 months ago
JSON representation
ignite - module: elixir and graphql with absinthe from rocketseat by Rafael Camarda
- Host: GitHub
- URL: https://github.com/raulpe7eira/food-diary
- Owner: raulpe7eira
- Created: 2022-05-14T22:38:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-18T23:48:23.000Z (12 months ago)
- Last Synced: 2024-02-19T00:57:14.877Z (12 months ago)
- Topics: absinthe, ecto, elixir, graphql, ignite, phoenix, postgresql, rocketseat
- Language: Elixir
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FoodDiary API
This repository is the code corresponding to the [Rocketseat - Ignite, Module: Elixir and GraphQL with Absinthe](https://app.rocketseat.com.br/node/elixir-e-graphql-com-absinthe-2022) lab by Rafael Camarda.
> The project simulates a Food Diary management API that allows to register users and meals with GraphQL.
## Previous installations
**Database**, we recommends install [PostgreSQL](https://www.postgresql.org/) with [Docker](https://hub.docker.com/_/postgres). After that, sets connection configuration at:
- `config/dev.exs`
- `config/test.exs`## Gets dependencies, setups database, tests, coverages, reports and starts application
```bash
cd food-diary
mix deps.get
mix ecto.setup
mix test
mix test --cover
mix phx.server
```## How to use?
```bash
# provides resources graphql
curl -X POST 'http://localhost:4000/api/graphql'# provides resources graphql with web development interface
curl -X POST 'http://localhost:4000/api/graphiql'
```### Resources GraphQL
```bash
# retrieves user
query {
user(id: 1) {
name
}
}# creates user
mutation {
createUser(input: {
email: "[email protected]",
name: "Fulano"
}) {
id
}
}# creates meal
mutation {
createMeal(input: {
userId: 3,
description: "Pizza",
calories: 370.50,
category: FOOD
}) {
id
}
}# listens new meal
subscription {
newMeal {
description
}
}
```