DEV Community

Cover image for Backend challenge #4
Carlos Estrada
Carlos Estrada

Posted on

Backend challenge #4

Welcome to the four challenge of this series of backend development. In today challenge we will start with more complex projects.

Today challenge main focus is to create the api for an already created website. The api needs the next requirements.

  • Should be listen on the url localhost:3131/api
  • Store the data (database, files, etc the choice is yours)
  • You need to create the next endpoint receipts with the next methods
    • GET
    • POST
    • PUT the url is receipts/:id instead of only receipts
    • DELETE the url is the same as in put
  • The data returned by the GET should be as follow:
[
    {id: 1, name: 'TEST 1'},
    {id: 2, name: 'TEST 2'}
]
Enter fullscreen mode Exit fullscreen mode
  • In the post and put you should recieve the next json, and you should return the resource to the client
{
    "name": "TEST"
}
// Response
{ id: 1, name: "TEST" }
Enter fullscreen mode Exit fullscreen mode

How to start the challenge

You can clone an start the frontend by your own, but the easiest way is to pull the docker image of the project and start a container.

# Pull the docker image
docker pull caresle/nature-food-receipt:v1.0

# Start a container
docker run -d -p 3000:3000 caresle/nature-food-receipt:v1.0

Enter fullscreen mode Exit fullscreen mode

Now you should be able to go to the frontend in the localhost:3000 port.

Landing page of nature food receipt

You can check the code of the project here

Conclusion

This is the 4 challenge of this backend series, in the next one we will play with a database that will be used for the 5-8 challenges, also if you run into an issue starting the development of the challenge please open an issue on the github repo. See you next time.

Top comments (0)