Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Node.js Blueprints

You're reading from   Node.js Blueprints Develop stunning web and desktop applications with the definitive Node.js

Arrow left icon
Product type Paperback
Published in Jun 2014
Publisher
ISBN-13 9781783287338
Length 268 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Krasimir Stefanov Tsonev Krasimir Stefanov Tsonev
Author Profile Icon Krasimir Stefanov Tsonev
Krasimir Stefanov Tsonev
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Common Programming Paradigms FREE CHAPTER 2. Developing a Basic Site with Node.js and Express 3. Writing a Blog Application with Node.js and AngularJS 4. Developing a Chat with Socket.IO 5. Creating a To-do Application with Backbone.js 6. Using Node.js as a Command-line Tool 7. Showing a Social Feed with Ember.js 8. Developing Web App Workflow with Grunt and Gulp 9. Automate Your Testing with Node.js 10. Writing Flexible and Modular CSS 11. Writing a REST API 12. Developing Desktop Apps with Node.js Index

The example-logging system

We've seen the main features of Express. Now let's build something real. The next few pages present a simple website where users can read only if they are logged in. Let's start and set up the application. We are going to use Express' command-line instrument. It should be installed using npm install -g express-generator. We create a new folder for the example, navigate to it via the terminal, and execute express --css less site. A new directory, site, will be created. If we go there and run npm install, Express will download all the required dependencies. As we saw earlier, by default, we have two routes and two controllers. To simplify the example, we will use only the first one: app.use('/', routes). Let's change the views/index.jade file content to the following HTML code:

doctype html
html
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
  body
    h1= title
    hr
    p...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime