Repository URL to install this package:
|
Version:
1.2.8 ▾
|
import { resolve as pathResolve } from 'path'
import { config } from '@skava/bs'
import express from 'express'
// also this is super weird because of webpack dev server not emitting the file
const expireSettings = {
// Cache-Control: private, max-age=604800
maxAge: process.env.BROWSER_MAX_CACHE_AGE,
index: false,
// @todo
// import { versions } from '../../../package.json'
// lastModified: versions && versions.date,
// index: ['vendor', 'workbox.js', 'index.js'],
// extensions: 'js'
// setHeaders < needed for security header types
}
// actually am super confused here...
// dist/dist/bundled/client/
// but it has index.js
// so does it resolve only index......?
// often there is no file here (o.o) < webpack dev server keeps in memory
const clientBundleOutputPath = pathResolve(
config.get('appRootDir'),
process.env.BUILD_CONFIG_WEB_OUTPUT_PATH
)
/**
* Middleware to server our client bundle.
*
* @example
* /usr/project-here/dist/client
*/
const staticMiddleware = express.static(clientBundleOutputPath, expireSettings)
export {
staticMiddleware,
staticMiddleware as clientBundle,
clientBundleOutputPath,
}
export default staticMiddleware