You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
648 B
JavaScript
26 lines
648 B
JavaScript
'use strict';
|
|
|
|
const express = require("express");
|
|
const path = require("path");
|
|
const webpackDevMiddleware = require("webpack-dev-middleware");
|
|
const webpackHotMiddleware = require("webpack-hot-middleware");
|
|
const webpack = require("webpack")(require("./webpack.config.js"));
|
|
|
|
let app = express();
|
|
|
|
app.use(webpackDevMiddleware(webpack, {
|
|
publicPath: "/static/"
|
|
}));
|
|
|
|
app.use(webpackHotMiddleware(webpack));
|
|
|
|
app.use("/static", express.static(path.join(__dirname, "public")));
|
|
|
|
app.get("/", (req, res) => {
|
|
res.sendFile(path.join(__dirname, "public/index.html"));
|
|
});
|
|
|
|
app.listen(3000, () => {
|
|
console.log("Server listening on port 3000");
|
|
});
|