To run this template out of the box on Brev click here:
Much of the code in this was borrowed from Tien Nguyen. Please check him out!
This repo runs a CRUD app which allows you to add and delete tutorials. A tutorial has the shape:
{
"title": "Learning to code",
"description": "How to learn the best skill in the world",
"published": true
}
There are two services in this repo: the backend node api and the database. Running:
docker-compose up
will spin them both up.
You can then pull the backend node service out of docker compose and run it locally:
- Comment out lines 15 to 30 of docker-compose.yml
- Run:
docker-compose up
- Then cd into backend and run it via npm:
cd backend
npm i
npm start
To view all tutorial entries:
curl http://localhost:8080/api/tutorials
To add a new tutorial:
curl --request POST \
--url http://localhost:8080/api/tutorials \
--header 'Content-Type: application/json' \
--data '{
"title": "Learning to code",
"description": "How to learn the best skill in the world",
"published": true
}'
To forward a port to your local machine (if you're using Brev), in VScode you should see a ports section next to terminal. Enter port 8080 to forward.