# start the container // remember to put the .env file in the root directory
$ yarn up
# stop the container
$ yarn down
http://localhost:3008/
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:cov
# copy the .env.template file to .env
$ cp .env.template .env
# edit the .env file and set the mySQL configuration variables
# make sure Docker Desktop is running, then start the container if it's not already running
$ yarn up
# start the application and connect to the database
$ yarn start:dev
The API has the following paths:
This path accepts a POST request with a JSON body containing two numbers, number1 and number2. The API returns the sum of the two numbers.
Example request body:
{
"number1": 40,
"number2": 2
}
Example response body:
{
"result": 42
}
This path accepts GET, POST, PATCH, and DELETE requests for managing notes. The API returns a list of notes in JSON format.
Example response body:
[
{
"id": 1,
"title": "Note 1",
"content": "This is the content of note 1"
},
{
"id": 2,
"title": "Note 2",
"content": "This is the content of note 2"
}
]
This path returns a list of all notes.
This path returns the note with the given ID.
Example response body:
{
"id": 1,
"title": "Note 1",
"content": "This is the content of note 1"
}
This path creates a new note with the given title and content.
Example request body:
{
"title": "Note 3",
"content": "This is the content of note 3"
}
This path updates the note with the given ID with the new title and content.
Example request body:
{
"title": "Note 3 (updated)",
"content": "This is the updated content of note 3"
}
This path deletes the note with the given ID.
- clone this repo
- create a new local branch
git switch -c alice-task-1
changing alice with your name - run
yarn test
and correct the error in the test file - add a
POST
controller that accepts a json{"number1": 40, "number2": 2}
and returns the sum- important: the controller doesn't know how to sum, but a new service does. So write the sum service in the proper place
- write a new test for this
POST
controller, testing different numbers - when done use
git status
to check that your changes are ok. Then usegit add *
andgit commit -m "<put a short explanation here>"
andgit push
- then go to the github project. You will see a button to make a new Pull Request out of your last commit. Do it and put me as the reviewer