mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-14 03:54:46 +00:00
19
test/apps/session/src/server.js
Normal file
19
test/apps/session/src/server.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import polka from 'polka';
|
||||
import * as sapper from '@sapper/server';
|
||||
|
||||
const { PORT } = process.env;
|
||||
|
||||
polka()
|
||||
.use((req, res, next) => {
|
||||
req.hello = 'hello';
|
||||
res.locals = { name: 'world' };
|
||||
next();
|
||||
})
|
||||
.use(
|
||||
sapper.middleware({
|
||||
session: (req, res) => ({
|
||||
title: `${req.hello} ${res.locals.name}`
|
||||
})
|
||||
})
|
||||
)
|
||||
.listen(PORT);
|
||||
Reference in New Issue
Block a user