There’s no secrete that in modern Web applications an ability to find required content fast is one of the most important things. So if your application won’t be responsive enough clients will use something else. That’s why all the processes should be optimized as much as possible, never the less it can be a very challenging task…
In real life we generally have more than one template. Moreover, if we create a website with several pages, it usually happens that a number of them are of the same design. The template systems should consider this aspect. Unfortunately, ejs doesn’t deal very well with this task. That’s why we are going to install a different templating system named ejs-locals(let us add it to app.js):
Favicon is the connect of Middleware that checks whether the url has a view of favicon.ico; if the answer is ‘yes’, it reads favicon and outputs, otherwise it transfers control further. The logger outputs a record what kind of a request we’ve received. For example, if we launch the app now, the logger will output something, when we follow:
Hey all! To develop our app further, we need to do two more vital things – configuration and logging. We will use the nconf module for configuring:
Please welcome, our first series of article about Node.js!
Hey, guys! Let’s continue our lesson about Express basics and Middleware.
The result is (add to app.js):
Hey all! This and next articles will be devoted to various themes on development within the context of one app that we will consequently improve. This app is a web chat.
Hey all! The first topic of this article is transferring of parameters and the script for Node.js. To show you the principle, we will create a file with a simple code, so add it (server.js):
How and what does app.js consist of?
It is made in a way that from the very beginning we create a domain and then launch our app within this domain. Here all modules can be connected, a server gets created, etc. But why do we connect modules here? The reason is that some other modules can be added when the connection happens, and they can connect others, too.
So, we continue our lesson. Let us make this example a little bit more complicated by adding work with the files in the following way: