backend to my fragments api
Run eslint and make sure there are no errors that need to be fixed: npm run lint
pretty-print the JSON (NOTE: the -s option silences the usual output to CURL, only sending the response from the server to jq: curl -s localhost:8080 | jq
The start script runs our server normally; dev runs it via nodemon, which watches the src/** folder for any changes, restarting the server whenever something is updated; debug is the same as dev but also starts the node inspector on port 9229, so that you can attach a debugger (e.g., VSCode):npm start
npm run dev
npm run debug
- Go to AWS Learner Lab, start it, then click on AWS Console.
- Click EC2
- Run
ssh -i ~/.ssh/dps955-key-pair.pem ec2-user@[Public IPv4 DNS]
- Remember to stop the lab
Optional: update source code
- Run
npm pack
in fragments repo - Run
scp -i dps955-key-pair.pem fragments-0.0.1.tgz ec2-user@[id]:
- Connect to the EC2 instance and run
tar -xvzf fragments-0.0.1.tgz
- Build an image with multiple tags:
docker build -t roboticbeing/fragments:latest -t roboticbeing/fragments:lab-6 -t roboticbeing/fragments:90f9154 .
- Push all tags:
docker push --all-tags roboticbeing/fragments
- Run container
docker run --rm --name fragments --env-file env.jest -e LOG_LEVEL=debug -p 8080:8080 -d roboticbeing/fragments:latest
Optional: run container with terminal -> docker run --rm --init --it [tagname] bash
- To go inside the image:
docker exec --it [id] bash
- Run
docker kill [id]