My background is in PHP and JavaScript, and I have limited experience with nodejs and angular js. While attempting to learn angular js 2, I encountered difficulties setting up my first example.
I am using node v 5.6.0 and npm version 3.7.2 on ubuntu 14.04.
I followed this article, but had to make a change due to the deprecation of tsd
. I used typings
instead of tsd
. Below is the structure of my folders.
https://i.sstatic.net/e28kG.png
However, when I run gulp buildServer
in the terminal, it gives me the following errors.
https://i.sstatic.net/J7PD8.png
I believe I may be making a simple mistake. If you could help me solve this issue or need more information, please let me know.
server.ts contains the following 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);
});