Skip to content

Instantly share code, notes, and snippets.

@kuc-arc-f
Created May 30, 2021
Embed
What would you like to do?
sapper POST setting
import sirv from 'sirv';
import polka from 'polka';
import compression from 'compression';
import * as sapper from '@sapper/server';
const { json } = require('body-parser');
const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === 'development';
polka() // You can also use Express
.use(json())
.use(
compression({ threshold: 0 }),
sirv('static', { dev }),
sapper.middleware()
)
.listen(PORT, err => {
if (err) console.log('error', err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment