Book Image

Learning Node.js for Mobile Application Development

By : Stefan Buttigieg
Book Image

Learning Node.js for Mobile Application Development

By: Stefan Buttigieg

Overview of this book

Node.js is a massively popular JavaScript library that lets you use JavaScript to easily program scalable network applications and web services. People approaching Node.js for the first time are often attracted by its efficiency, scalability, and the fact that it's based on JavaScript, the language of the Web, which means that developers can use the same language to write backend code. Also, it’s increasingly being seen as a modern replacement for PHP in web development, which relies on fast-paced data exchange. The growing community and the large amount of available modules makes Node.js one of the most attractive development environments. This book takes a step-wise and incremental approach toward developing cross-platform mobile technologies using existing web technologies. This will allow you to truly understand and become proficient in developing cross-platform mobile applications with Node.js, Ionic Framework, and MongoDB. The book starts off by introducing all the necessary requirements and knowledge to build a mobile application with a companion web service. It covers the ability to create an API from scratch and implement a comprehensive user database that will give you the opportunity to offer a mobile application with a personalized experience. Midway through the book, you will learn the basic processes to create a successful mobile application. You will also gain higher-level knowledge, allowing you to develop a functional and secure mobile application to ensure a seamless user experience for end users. Finally, the book ends with more advanced projects, which will bring together all the knowledge and expertise developed in the previous chapters to create a practical and functional mobile-application that has useful real-world features.
Table of Contents (16 chapters)
14
14. Creating an E-Commerce Application Using the Ionic Framework
15
Index

Creating a multiroom chat application

Let's take a brief refresher on the basic Chat App that we built during the course of the previous chapter:

Creating a multiroom chat application

This app effectively sets up a connection to the WebSocket server and lets us talk to random strangers who, for some reason, are loitering in the kitchen and using the Wi-Fi connection. What we want to do here is give these strangers (and ourselves) the possibility to pick separate chat rooms depending on what they are keen to talk about. Since we love programming, programming languages are of course going to be the be-all-and-end-all of what is on the menu.

Configuring the basic layout

In order to create a nice way to navigate between different chat rooms, we will use a tabbed layout, where each tab will correspond to a single chat room.

This means that we will need to make several changes to our HTML as well as the routing for our app. Start out by modifying the index.html file. Make sure that it looks like the following:

<!DOCTYPE html&gt...