Summary
In this chapter, we first connected our chat app to the database by storing messages in MongoDB. We also learned how to make documents expire after a certain amount of time. Then, we implemented functionality to replay messages when a new user joins the chat. Next, we spent some time refactoring the chat app to make it more extensible and maintainable in the future. Finally, we implemented ways to join new rooms and switch between rooms.
Up until now, we have only been using libraries to develop our apps. In the next chapter, Chapter 16, Getting Started with Next.js, we will learn how to use a full-stack React framework for developing apps. Frameworks, such as Next.js, provide more structure for our apps and offer us a lot of features, such as server-side rendering, out of the box.