We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 51bd8c9 commit 98cc35eCopy full SHA for 98cc35e
1 file changed
docs/GETTING_STARTED.md
@@ -117,8 +117,13 @@ await server.register({
117
/**
118
* View context attributes made available to your pages. Returns an object containing an arbitrary set of key-value pairs.
119
*/
120
- viewContext: async (request) => {
121
- "example": "hello world" // available to render on a nunjucks page as {{ example }}
+ viewContext: async (request) => { // async can be dropped if there's no async code within
+ const user = await userService.getUser(request.auth.credentials)
122
+
123
+ return {
124
+ "greeting": "Hello" // available to render on a nunjucks page as {{ greeting }}
125
+ "username": user.username // available to render on a nunjucks page as {{ username }}
126
+ }
127
}
128
129
})
0 commit comments