Wrap Up
Recap the knowledge acquired in this chapter and review a complete piece of code containing all functionality taught so far.
We'll cover the following
Concepts learned in this chapter
What is a server, and how do we listen and serve HTTP requests over a TCP connection?
What is the life cycle of a server, and how do we gracefully handle it?
How do we test our code?
What should we log, and how should we do it?
What are REST APIs, and how do I design and document them?
How do I elegantly write routers that can handle multiple methods, paths, and different kinds of user requests?
How do I read and write data in JSON?
How do I operate on data structures in a concurrency-safe manner?
These are all questions you should be able to answer confidently at this point.
If not, please return to the lesson addressing the topic(s) and the quizzes and exercises after those lessons. These are the foundation blocks for what it takes to build back-end services. Simple ones, no doubt, but effective nonetheless.
Final code review
Before we go any further, let’s take one good look at the service we’ve built together so far. Go through the code again because we’ve made several changes. Notice the structural changes that should show you the value addition of writing modular code when you see how much neater things look. Plus, we’ve changed the user type to make our APIs cleaner and add some functionality.
Play around with it, add new things, tweak it however you like, and get comfortable with this server. It has all the functionality we have discussed so far. We have, however, skimped on the logging department to keep the code slightly shorter and more readable on this website. Nevertheless, we strongly urge you to add meaningful logs of your own and give this a spin. Error logs are almost always a must.
If you have any questions, now would be the best time to ask and get them all addressed before moving on. Never hesitate to reach out and ask.
Get hands-on with 1400+ tech skills courses.