Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit d062e75

Browse files
author
Jacob Bowdoin
authored
site: give example of passing a session option (#1090)
1 parent 7d3a85c commit d062e75

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

site/content/docs/04-preloading.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ So if the example above was `src/routes/blog/[slug].svelte` and the URL was `/bl
3939
* `page.query.foo === 'bar'`
4040
* `page.query.baz === true`
4141

42-
`session` is generated on the server by the `session` option passed to `sapper.middleware` (TODO this needs further documentation. Perhaps a server API section?)
42+
`session` is generated on the server by the `session` option passed to `sapper.middleware`. For example:
43+
44+
```js
45+
sapper.middleware({
46+
session: (req, res) => ({
47+
user: req.user
48+
})
49+
})
50+
```
4351

4452

4553
### Return value

0 commit comments

Comments
 (0)