This is the back-end API for the Chronomeal app. Chronomeal allows people with chronic pain to record their meals and pain levels, so they or their doctor can look for trends over time.
git clone https://github.com/MattLong87/chronomeal-api
cd chronomeal-api
npm install
tsc
npm start
(ornpm run dev
)
- When user is created or logs in with username and password, token is generated and returned
- Future requests supply token in header:
"Authorization: Bearer {token}"
GET /api/users/me
POST /api/login
Required body fields:
- email (string)
- password (string)
POST /api/users
Required body fields:
- email (string)
- password (string)
- firstName (string)
- lastName (string)
POST /api/users/me/add-meal
Required body fields:
- time (string)
- food (string)
- notes (string, even if empty)
- pain (number)
DELETE /api/users/me/meals
Required body fields:
- mealId (string, the _id field in the chosen meal)