Angular2 application is working well already.I have been trying to implement MEAN stack with that angular2 application by adding server.js but I ain't sure why i don't find index.html webpage not appearing in browser.
My folder structure is:
And express.js is:
var express=require('express');
var app=express();
app.use('/src',express.static(__dirname+'/src'));
app.get('/',function(req,res){
res.sendFile(__dirname+'/src/index.html');
});
app.listen(3000);
The path is all right but in browser,
.
I even tried with ng build to obtain dist folder and tried pointing to dist/index.html but it didn't work as well.Please favour.
Edit: index.html -src
<html lang="en">
<head>
<meta charset="utf-8">
<title>Something</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
index.html - dist
<html lang="en">
<head>
<meta charset="utf-8">
<title>Something</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
<script type="text/javascript" src="inline.bundle.js"></script><script type="text/javascript" src="polyfills.bundle.js"></script><script type="text/javascript" src="styles.bundle.js"></script><script type="text/javascript" src="vendor.bundle.js"></script><script type="text/javascript" src="main.bundle.js"></script></body>
</html>
i am here
, i am able to view "i am here" in browser. So, problem is with loading the component. So fishy! – Gayathri Jul 30 '17 at 03:46