-
Notifications
You must be signed in to change notification settings - Fork 374
Open
Description
What is the type of issue?
Documentation is confusing
What is the issue?
Often examples are unnecessarily confusing, either being too comprehensive or using unnecessary names that are misleading.
import { Elysia } from 'elysia'
const plugin = new Elysia({ name: 'plugin' })
.macro(({ onBeforeHandle }) => ({
hi(word: string) {
onBeforeHandle(() => {
console.log(word)
})
}
}))
const app = new Elysia()
.use(plugin)
.get('/', () => 'hi', {
hi: 'Elysia'
})
Shoud be something like:
import { Elysia } from 'elysia'
const plugin = new Elysia({ name: 'plugin' })
.macro(({ onBeforeHandle }) => ({
exampleMacroName(word: string) {
onBeforeHandle(() => {
console.log(word)
})
}
}))
const app = new Elysia()
.use(plugin)
.get('/', () => 'handler result', {
exampleMacroName: 'text passed to macro'
})
Where did you find it?
https://elysiajs.com/essential/handler.html#macro
I will try over time to provide a complete list of places where I had problems interpreting the examples.
Metadata
Metadata
Assignees
Labels
No labels