How to use the angular2-universal-preview.ng2engine function in angular2-universal-preview

To help you get started, we’ve selected a few angular2-universal-preview examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dbabaioff / ng2-universal-seed / server.js View on Github external
var express   = require('express');
var ng2engine = require('angular2-universal-preview').ng2engine;

// Angular 2
var App = require('./dist/server/app').App;

var app = express();

// Express View
app.engine('.ng2.html', ng2engine);
app.set('views', __dirname);
app.set('view engine', 'ng2.html');


// static files
app.use(express.static(__dirname));


app.use('/', function(req, res) {
    res.render('index', {App: App});
});

app.listen(3000, function() {
    console.log('Listen on http://localhost:3000');
});