mirror of
https://github.com/nexus-stc/hyperboria
synced 2024-12-02 16:02:53 +01:00
8472f27ec5
GitOrigin-RevId: ddf02e70d2827c048db49b687ebbcdcc67807ca6
23 lines
740 B
JavaScript
23 lines
740 B
JavaScript
const config = require('./{config_path}')
|
|
const webpackConfig = require('./{webpack_config_path}')
|
|
const webpack = require('webpack')
|
|
const express = require('express')
|
|
const app = express()
|
|
const path = require('path')
|
|
|
|
const outputPath = path.join(process.cwd(), '{static_path}')
|
|
webpackConfig.output.path = outputPath
|
|
|
|
webpack(webpackConfig, (err, stats) => { // Stats Object
|
|
if (err || stats.hasErrors()) {
|
|
console.error(err || stats)
|
|
}
|
|
app.use(express.static(outputPath))
|
|
app.get('/', (req, res) => {
|
|
res.sendFile('./index.html', { root: outputPath })
|
|
})
|
|
app.listen(config.application.port, config.application.host, () => {
|
|
console.log(`Dynamic server is listening on port: ${config.application.port}`)
|
|
})
|
|
})
|