Book Image

Learn Node.js by Building 6 Projects

By : Eduonix Learning Solutions
Book Image

Learn Node.js by Building 6 Projects

By: Eduonix Learning Solutions

Overview of this book

<p>With its event-driven architecture and efficient web services capabilities, more and more companies are building their entire infrastructure around Node.js. Node has become a de facto part of web development that any serious developer needs to master.</p> <p>This book includes six Node.js projects that gradually increase in complexity. You'll start by building a simple web server and create a basic website. You will then move to create the login system, blog system, chat system, and e-learning system.</p> <p>By creating and following the example projects in this book, you’ll improve your Node.js skills through practical working projects, and you'll learn how to use Node.js with many other useful technologies, such as ExpressJS, Kickstart, and Heroku.</p>
Table of Contents (12 chapters)

A custom layout template


 We will now create a custom template for our application. The first thing that we will do is to go into the views folder and open layout.jade; there are a few things that we need to do here. We will set up just a very basic structure, so we will go right under the body tag here and add a space and create a class called container:

doctype html
html
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
  body
   .container

    block content

In the container class, we will create an img tag using Jade, giving it a class of logo (I'll give it an src attribute); we'll set this to /images/nodebloglogo.png, and this will be in your files:

 .container
 img.logo(src='/images/nodebloglogo.png')

In this container, we will create a nav tag, and inside this, we'll have a ul; next, we'll have li, and then, we'll have the a link, let's give it an href attribute, which will go to /, and after this, we'll say Home:

.container
 img.logo(src='/images/nodebloglogo...