Skip to content

Commit ba14ee4

Browse files
committed
deploy angular app to heroku demo code
1 parent ac9cf6b commit ba14ee4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

server.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ const path = require('path');
55
const app = express();
66

77
// Serve only the static files form the dist directory
8-
app.use(express.static(__dirname + '/dist/<name-of-app>'));
8+
app.use(express.static('./dist/angular-app-heroku'));
99

10-
app.get('/*', function(req,res) {
11-
12-
res.sendFile(path.join(__dirname+'/dist/<name-of-app>/index.html'));
13-
});
10+
app.get('/*', (req, res) =>
11+
res.sendFile('index.html', {root: 'dist/angular-app-heroku/'}),
12+
);
1413

1514
// Start the app by listening on the default Heroku port
1615
app.listen(process.env.PORT || 8080);

0 commit comments

Comments
 (0)