Created
July 2, 2019 17:30
-
-
Save evdama/149d9c0789ef7ffb476212dc37c9a6d3 to your computer and use it in GitHub Desktop.
working version of server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @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