-
-
Notifications
You must be signed in to change notification settings - Fork 181
Closed
Description
Description
Server not setup ctx.locals
const server = require('server')
const {get, error} = server.router
const {status} = server.reply
server(
ctx => { ctx.locals.username = 'franciscop' },
get('/', ctx => `Username is: ${ctx.locals.username}`),
error(ctx => status(500).send(ctx.error.message))
)Expected outcome
When I access http://localhost:3000/ I should get:
Username is: franciscop
Actual outcome
But when I access http://localhost:3000/ I got:
Cannot set property 'username' of undefined
Live Demo
Example: https://glitch.com/edit/#!/join/17c45851-d9ac-4e98-a912-305f8e4b4dc6
System Information
OS: Windows 10
Node Version: v8.9.4
Server.js Version: 1.0.18