Fetch exercise from server
This commit is contained in:
+13
-10
@@ -1,17 +1,20 @@
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
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';
|
||||
import { getConfig } from './config';
|
||||
|
||||
const config = getConfig(dotenv.config().parsed);
|
||||
|
||||
polka() // You can also use Express
|
||||
.use(
|
||||
compression({ threshold: 0 }),
|
||||
sirv('static', { dev }),
|
||||
sapper.middleware()
|
||||
)
|
||||
.listen(PORT, err => {
|
||||
if (err) console.log('error', err);
|
||||
});
|
||||
.use(
|
||||
compression({ threshold: 0 }),
|
||||
sirv('static', { dev: true }),
|
||||
sapper.middleware()
|
||||
)
|
||||
.listen(config.port, (err) => {
|
||||
if (err) console.log('error', err);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user