You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@LoganArnett mentioned in a PR the idea of renaming derived or decorated properties of plugins when they are included in an actual application. This could prevent naming collisions in the future and give users the freedom to name things as they wish.
It would be nice to do this standardized via Elysia itself, such as:
import{Elysia}from'elysia';// this would be a plugin provided by a third partyconstmyPlugin=(app: Elysia)=>app.decorate('myProperty',42);newElysia().use(myPlugin.mapContext({myProperty: 'prop'// rename derived or decorated properties one by one}).prefixAll('my-')// and/or apply a prefix to all).get('/',(ctx)=>ctx['my-prop']).listen(8080);
In the logger plugin it is currently implemented as follows:
constapp=newElysia().use(logger({contextKeyName: 'myLogger'})).get('/',(ctx)=>{// property "myLogger" is available instead of "log"ctx.myLogger.info(ctx.request,'Request');return'Hello World';}).listen(8080);
The text was updated successfully, but these errors were encountered:
@LoganArnett mentioned in a PR the idea of renaming derived or decorated properties of plugins when they are included in an actual application. This could prevent
naming collisions
in the future and give users thefreedom to name things as they wish
.It would be nice to do this standardized via
Elysia
itself, such as:In the logger plugin it is currently implemented as follows:
The text was updated successfully, but these errors were encountered: