To better assess a candidate's backend development skills, we would like to provide the following challenge. We ask that you not spend more than 4 hours on this project.
The goal of this project is to familiarize yourself with the backend Node.js API in this repository and then implement missing features and tests.
The project must be completed with Node.js v14 or later
- Modify the
GET /dev/status
route to only return a200 OK
if the server is currently connected to the database - Add a test for
PUT /dev/user/:id
that shows the current user must match the user id in the url in order for the update to be successful - Create a new module called
notes
that lets a user a save notes to their account. ANote
should simply have a title and a message in addition to the common properties such as id, createdAt and modifiedAt. - Add the route
GET /dev/user/:id/notes
which should list all notes for that user. Remember to ensure the user id in the url matches the current user making the request - Add a test for the previous route to show that it works correctly
- Add a route
POST /dev/note
which should let a logged in user create a note and save it to their account
- Clone this repository to your local machine
git clone https://github.com/BarstoolSports/backend-challenge.git
- Install and run MongoDB https://docs.mongodb.com/manual/administration/install-community/
- Install Node.js v14 from https://nodejs.org
- Install Yarn v1.22 from https://yarnpkg.com/en/
- Open the project diretory in a terminal and run
yarn install
- run
npx husky install
If the project is setup correctly you should be able to run the existing set of tests:
yarn test
After ensuring the tests are running correctly, start the app:
yarn start
If the server starts up successfully you will see a log in the console letting you know the server is running and listening on port 3000. Open the /dev/status
route to confirm: http://localhost:3000/dev/status