Skip to content

Instantly share code, notes, and snippets.

@evdama
Created July 2, 2019 17:30
Show Gist options
  • Save evdama/149d9c0789ef7ffb476212dc37c9a6d3 to your computer and use it in GitHub Desktop.
Save evdama/149d9c0789ef7ffb476212dc37c9a6d3 to your computer and use it in GitHub Desktop.
working version of server.js
// @ts-nocheck TODO: remove at some point
// TODO: what todo with those two imports? needed? if so why and how?
//import config from './config';
//import './css/index.css';
import sirv from 'sirv';
import polka from 'polka';
import compression from 'compression';
import * as sapper from '@sapper/server';
const {
PORT,
NODE_ENV
} = process.env;
const dev = NODE_ENV === 'development';
if ( dev ) {
polka() // You can also use Express
.use(
compression( {
threshold: 0
} ),
sirv( 'static', {
dev
} ),
sapper.middleware()
)
.listen( PORT, err => {
if ( err ) console.log( 'error', err );
} );
}
export {
sapper
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment