aboutsummaryrefslogtreecommitdiff
path: root/src/server/index.ts
diff options
context:
space:
mode:
authorMonika Hedman <monika_hedman@brown.edu>2019-02-12 16:26:22 -0500
committerMonika Hedman <monika_hedman@brown.edu>2019-02-12 16:26:22 -0500
commit05a710e2a541a07347d1626489a1811874126c79 (patch)
treefeb751e46036d2104bb81c5bcc4e4ab0b6336c08 /src/server/index.ts
parent6445930e05e8eb81a36930615926712986bc1a9d (diff)
parent7a93f60c9529e5d175e617fc7c07145a9b33e572 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into hedmanLocal
Diffstat (limited to 'src/server/index.ts')
-rw-r--r--src/server/index.ts29
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