diff options
author | yipstanley <stanley_yip@brown.edu> | 2019-02-10 22:12:04 -0500 |
---|---|---|
committer | yipstanley <stanley_yip@brown.edu> | 2019-02-10 22:12:04 -0500 |
commit | 69f0b463a78c82aaf78ceb6a5162431424452311 (patch) | |
tree | a54c7129f36d307420422b3babfa6da4d85db67e /src/server/index.ts | |
parent | 2e930b98726a09e597106d43a6763dd36d038771 (diff) | |
parent | 099c5823f05285fc5086c5a433658cf06dc4a04b (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into server_implementation
Diffstat (limited to 'src/server/index.ts')
-rw-r--r-- | src/server/index.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/server/index.ts b/src/server/index.ts new file mode 100644 index 000000000..640ad8180 --- /dev/null +++ b/src/server/index.ts @@ -0,0 +1,29 @@ +import * as express from 'express' +const app = express() +import * as webpack from 'webpack' +import * as wdm from 'webpack-dev-middleware'; +import * as whm from 'webpack-hot-middleware'; +import * as path from 'path' +const config = require('../../webpack.config') +const compiler = webpack(config) +const port = 1050; // default port to listen + +// define a route handler for the default home page +app.get("/", (req, res) => { + res.sendFile(path.join(__dirname, '../../deploy/index.html')); +}); + +app.get("/hello", (req, res) => { + res.send("<p>Hello</p>"); +}) + +app.use(wdm(compiler, { + publicPath: config.output.publicPath +})) + +app.use(whm(compiler)) + +// start the Express server +app.listen(port, () => { + console.log(`server started at http://localhost:${port}`); +});
\ No newline at end of file |