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.
- Fork and then 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/ or use Docker)
- Install Node.js v20.18.0
- Install Yarn
- Open the project directory in a terminal and run
yarn 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
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 v20.18.0
- Update
.envto have proper Mongo connection string - Modify the
GET /dev/statusroute to only return a200 OKif the server is currently connected to the database - Add tests for
PUT /dev/user/:idthat 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
notesthat lets a user save notes to their account. ANoteshould 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/noteswhich should list notes for that user - Add a validator to
GET /dev/user/:id/notesand ensure users can paginate, sort, and search/filter their own Notes based on message text - Add tests for the previous route to show that it functions correctly
- Add a route
POST /dev/notewhich should let a logged in user create a note and save it to their account - Add tests for the previous route to show that it functions correctly