GoConqr has a new look! Let us know what you think.

Notes

Getting started with express

James Drummond node.js A-Level English 1 page

Content of the notes (1)

Page 1

Hold the phone!

See https://github.com/DaftMonk/generator-angular-fullstack for a Yeoman generator that installs express with Angular.

It also includes options for creating angular services / directives, et;

See http://cwbuecheler.com/web/tutorials/2013/node-express-mongo/

See http://briantford.com/blog/angular-express for creating a restful api with express.

Install Express with NPM so that you can run it from the command line.

Run 'express [new project name]' . This will create a new express project in the same directory as the new project name

You want to update package.json depending on what else you want to install.

- Almost definitely you will want to install mongo, mongoose

Working with handlebars

See https://www.npmjs.com/package/express3-handlebars

You need to tell express which rendering engine to use in app.js:

app.engine('handlebars', exphbs({defaultLayout: 'main'}));

app.set('view engine', 'handlebars');

The default layout argument is specifying that you should use layouts/main.handlebars as the layout template. Other templates, depending on the rendering engine, will be injected into this one in the routes page:

/* GET home page. */ router.get('/', function(req, res, next) {

res.render('home');

});

'home' is views/home.handlebars

Information

Description
A-Level node.js Note on Getting started with express, created by James Drummond on 24/02/2015.
Created by
James Drummond
Views
2
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?