GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Notizen

Getting started with express

James Drummond node.js A-Level Englisch 1 Seite

Inhalt der Notizen (1)

Seite 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

Informationen

Beschreibung
A-Level node.js Notiz am Getting started with express, erstellt von James Drummond am 24/02/2015.
Erstellt von
James Drummond
Aufrufe
2
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck