https://github.com/ecelis/nutricion-energetica
Meal plan generator RESTful API
https://github.com/ecelis/nutricion-energetica
expressjs javascript mongodb nodejs showcase
Last synced: about 2 months 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 (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-25T00:57:43.000Z (almost 3 years ago)
- Last Synced: 2025-04-12T21:39:36.339Z (about 1 year ago)
- Topics: expressjs, javascript, mongodb, nodejs, showcase
- Language: JavaScript
- Homepage: https://healthcoach.app.patito.club
- Size: 1.46 MB
- Stars: 2
- 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
```