¡GoConqr estrena diseño! Cuéntanos qué te parece.

Apuntes

Getting started with express

James Drummond node.js A-Level Inglés 1 página

Contenido del apunte (1)

Página 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

Información

Descripción
A-Level node.js Apunte sobre Getting started with express, creado por James Drummond el 24/02/2015.
Creado por
James Drummond
Visitas
2
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?