Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ecelis/nutricion-energetica
Meal plan generator RESTful API
https://github.com/ecelis/nutricion-energetica
expressjs javascript mongodb nodejs showcase
Last synced: 17 days ago
JSON representation
Meal plan generator RESTful API
- Host: GitHub
- URL: https://github.com/ecelis/nutricion-energetica
- Owner: ecelis
- License: mit
- Created: 2022-05-04T16:30:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-25T06:57:51.000Z (over 1 year ago)
- Last Synced: 2023-05-25T08:15:34.727Z (over 1 year ago)
- Topics: expressjs, javascript, mongodb, nodejs, showcase
- Language: JavaScript
- Homepage: https://healthcoach.app.patito.club
- Size: 1.55 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# healthcoach API
I started this project to dust off my JavaScript skills and learn [Sequelize](https://sequelize.org/) and 💅🏾[styled-components](https://styled-components.com/) in the process. Also as a showoff to potential employers while I was in the hunt for a new job.
This is the RESTful API for [Web Health Coach](https://github.com/ecelis/healtcoach).
## Dependencies
Requires a Sendgrid account
## Develop
### Environment setup
There are two config files, this is redundant and will be fixed in the near future.
Copy `cp config/sample.config.json config/config.json` and edit `config/config.json` with proper values.
Copy `cp env.sample .env.local` and edit `.env.local` with proper values.
### Docker
Azure currently runs PostgreSQL 13.7
```
docker compose up -d
``````
docker build -t whcapi .
```### Migrate
```
npm run migrate
```To undo all migrations
```
npm run migrate:undo
```### Install and run with `nodemon`
```
npm install -g nodemon
nodemon
```## Test
Run test environment first
Execute tests
```
npm run test
```## Clean and import food data
```
.mode csv
.import data/food.csv food
```## Deploy
### Publish API docker image to Azure Container Registry
Build image
```
az acr build --registry webhealthcoach --image api .
```TODO (something about amin user enabled for related tasks in Azure)
Enable ???```
az acr update -n webhealthcoach --admin-enabled true
```Create task to deploy container when new images are published in the registry.
```az acr task create --registry webhealthcoach --name buildapi \
--image api \
--context https://github.com/ecelis/nutricion-energetica.git \
--file Dockerfile --git-access-token
```### Garbage
```
docker run -d --name whcapi -p 3000:3000 --env-file=.env.docker --link whcdb whcapi
``````
psql "host=.postgres.database.azure.com port=5432 \
dbname= user= password= sslmode=require"
```
```
psql -Uwhcuser -dwhc_dev
```