DEV Community

Cover image for Backend challenge #4
Carlos Estrada
Carlos Estrada

Posted on

1

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.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more