Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // @ts-nocheck
- // TODO: remove once there are typings in place
- import './css/tailwind.css';
- import * as sapper from '@sapper/server';
- import compression from 'compression';
- import express from 'express';
- import helmet from "helmet";
- import sirv from 'sirv';
- import uuidv4 from 'uuid/v4';
- const {
- PORT,
- NODE_ENV
- } = process.env;
- const dev = NODE_ENV === 'development';
- const app = express();
- if ( dev ) app.use( sirv( 'static', { dev } ) );
- app.use( ( request, response, next ) => {
- response.locals.nonce = uuidv4();
- next();
- } );
- app.use(
- helmet(
- // {
- // contentSecurityPolicy: {
- // directives: {
- // scriptSrc: [
- // "'self'",
- // ( request, response ) => `'nonce-${response.locals.nonce}'`
- // ]
- // },
- // browserSniff: false
- // }
- // }
- ),
- sapper.middleware(),
- compression({ threshold: 0 })
- );
- if ( dev ) {
- // only listen when started in dev
- app.listen( PORT, err => {
- if ( err ) console.log( 'error', err );
- } );
- }
- export {
- app
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement