Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import handleRender from 'server/utils/render'
import projectConfig, { paths } from '../../config'
const debug = _debug('app:server:prod')
const app = new Koa()
const { SERVER_HOST, SERVER_PORT } = projectConfig
app.use(helmet())
app.use(compress({
threshold: 2048,
flush: require('zlib').Z_SYNC_FLUSH
}))
app.use(convert(htmlMinifier({
caseSensitive: true,
// removeComments: true,
removeCommentsFromCDATA: true,
removeCDATASectionsFromCDATA: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeOptionalTags: true,
minifyJS: true,
minifyCSS: true,
export default function createServer({apps=[], heapId}) {
const server = koa();
apps.forEach(app => server.use(serve(`${app}/public`)));
server.use(serve(`${__dirname}/../public`));
server.use(logger());
server.use(compress());
server.use(htmlMinifier({collapseWhitespace: true}));
server.use(panels({heapId, prerender: !!process.env.PRERENDER}));
return server;
}