I'm starting an Angular2 Application and I'm setting up my server using express and Angular CLI 1.0.0-beta.25.5
In this kind of file structure:
project root
|-server
|-server.ts
|-src
|-app
When I run nodemon server.ts
I get the following error:
import
s are working elsewhere in my app
though, so I'm not sure what the issue is. I'm also not getting any vs code errors to suggest that any thing was imported incorrectly. Also both express
and body-parser
have been npm install --save
ed as well as the @types/express
(--save-dev
). What is preventing this import statement form working and how can I correct the issue?
server.ts
import * as express from 'express';
import {Application} from 'express';
import {apiFoods} from './api/apiFoods';
const bodyParser = require('body-parser');
const app: Application = express();
app.use(bodyParser.json());
apiFoods(app);
app.listen(8090, () => {
console.log('Server is now running on port 8090 ...');
});