generated from Mhdez221993/webpack-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
38 lines (30 loc) · 949 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const express = require('express');
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const cors = require('cors');
const app = express();
const config = require('./webpack.config.js');
const compiler = webpack(config);
// Tell express to use the webpack-dev-middleware and use the webpack.config.js
// configuration file as a base.
// app.use(
// webpackDevMiddleware(compiler, {
// publicPath: config.output.publicPath,
// })
// );
app.use(
webpackDevMiddleware(compiler, {
publicPath: config.output.publicPath,
}),
cors(
{credentials: true,}
)
);
app.post('https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/', function (req, res) {
res.header("Access-Control-Allow-Origin", "*");
res.send('hello world')
})
// Serve the files on port 3000.
app.listen(3000, function () {
console.log('Example app listening on port 3000!\n');
});