Thursday, 11 May 2017

Unable to get path after deploying Angular 2 on Heroku

I'm deploying angular 2 Node.js app on HEROKU. I have successfully deployed application with node version 6.10.2 and npm v3.10.10

The problem that I'm facing is "Cannot GET /" when i hit URL. In logs :

2017-05-11T16:46:42.862018+00:00 heroku[router]: at=info method=GET path="/" hos t=frontend1234.herokuapp.com request_id=86e9f7d1-086d-44dc-b3cf-92356fbbb182 fwd ="122.173.192.220" dyno=web.1 connect=0ms service=34ms status=404 bytes=383 prot ocol=https

My Server.js is :

const express = require('express');

const app = express();

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

var port = process.env.PORT || 5000;
app.listen(port, function(){
    console.log('server running on port ' + port);
})

Please help me to know how i can give proper path configuration in server.js. Thanks in Advance.



via Reetika

No comments:

Post a Comment