I have PHP and JavaScript background and never worked with nodejs or angular js with full hand , just a basic understanding of these js.
I started to learn angular js 2 but find very difficulties to set up first example.
node v 5.6.0 and npm version 3.7.2 on ubuntu 14.04
I am following this article with a change -- that tsd
has been deprecated so used typings
instead of tsd
. below is my folder structure.
But when I run gulp buildServer
on terminal it gives below errors
I may be doing very basic error , kindly help me to solve this and if required more information then tell me.
server.ts has below code
import express = require('express');
import path = require('path');
var port: number = process.env.PORT || 3000;
var app = express();
app.use('/app', express.static(path.resolve(__dirname, 'app')));
app.use('/libs', express.static(path.resolve(__dirname, 'libs')));
var renderIndex = (req: express.Request, res: express.Response) => {
res.sendFile(path.resolve(__dirname, 'index.html'));
}
app.get('/*', renderIndex);
var server = app.listen(port, function() {
var host = server.address().address;
var port = server.address().port;
console.log('This express app is listening on port:' + port);
});
You need to get the type definitions for node and server-static.
You need
mime
sinceserve-static
relys on it.