DEV Community

Carlos Estrada
Carlos Estrada

Posted on

1

Backend Challenge #3

Welcome to the third entry of this series to practice and learn more about backend development.

In the first post we challenge you to create a single endpoint, to perform the core four actions in each application (CREATE, READ, UPDATE, DELETE) with no database connection. However in the second post we stick with a single endpoint but add a connection with a database.

Today we will go a little further and make this a little bit more challenging, so let’s jump to see today’s challenge.

1 Save a message to a plain text file

Project description

Our friend Oscar, ask us if from the next request we can make a little program that does the next

// Oscar example request
// POST http://localhost/messages
{
    "sender": "Caresle",
    "message": "This is my message"
}
Enter fullscreen mode Exit fullscreen mode
  • Save the param message of the JSON body into a plain text file
  • The text file should be named as follow [id]_[sender].txt
  • We need to save the next information in a database
    • Sender of the message
    • Path of the file
  • Display the information as follow, the link to consult the information must require the id of the message that they want to consult. For example: /1 o /2
{
    "sender": "Caresle",
    "message": "This is my message"
}
Enter fullscreen mode Exit fullscreen mode

Notes

The message must not be saved in the database (no matter if it’s small)

You need to create the tables that you need alongside with the structure for creating and retrieving the information

You not need to implement a PUT or DELETE method

Conclusion

This will be the last easy challenge, from here we will start doing a little more complex things, and a bit more difficult.

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay