Skip to content

Commit

Permalink
Merge pull request #155 from Arquisoft/develop
Browse files Browse the repository at this point in the history
trying to fix router problem
  • Loading branch information
paulasuarezp authored Apr 29, 2023
2 parents 3181c75 + a00bf55 commit 98ef0db
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions webapp/server.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import express, { Application } from 'express';
//for using an import here we need to configure the tsconfig.json
//setting the option module to commonjs
const path = require('path');

const publicPath = path.join(__dirname, '.', 'build');

var app: Application = express();
const port: number = 3000;

app.use(express.static("build"));

app.get('*', (req, res) => {
res.sendFile(path.join(publicPath, 'index.html')), function(err: any) {
if (err) {
res.status(500).send(err)
}
};
});

app
.listen(port, (): void => {
console.log("Webapp started on port " + port);
Expand Down

0 comments on commit 98ef0db

Please sign in to comment.