Unable to extend the app's context in Koa@2
See original GitHub issueTrying to extend the context of the application since migrating to koa@2 throws this error:
TypeError: Cannot set property 'property_name' of #<Object> which has only a getter
A small example code
import Koa from 'koa';
const app = new Koa();
app.context.host = process.env.HOST || '0.0.0.0';
app.context.port = process.env.PORT || 8080;
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Adding properties to Koa2's context in Typescript
My current approach is to augment the Koa2 context but I'm failing because I don't know how to fix the type definition. Here...
Read more >Koa - next generation web framework for node.js
app.context is the prototype from which ctx is created. ... Koa applications extend an internal EventEmitter. ctx.app.emit emits an event with a type, ......
Read more >fleek-validator: Documentation | Openbase
This package is to be used as middleware for Koa2 to validate swagger documentation using ctx.fleek.context defined by fleek-context or an equivalent custom ......
Read more >Koa (koajs) -- 基于Node.js 平台的下一代web 开发框架| Koajs ...
nvm install 7 $ npm i koa $ node my-koa-app.js ... app.context 是从其创建 ctx 的原型。您可以通过编辑 app.context 为 ctx 添加其他属性。
Read more >The Best Node.js Framework: Koa VS Express VS Hapi ...
You can increase the performance of a Node.js app greatly by launching a cluster of processes (a cluster runs multiple instances of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
6666666
for(var i=0;i<100;i++){ console.log(i) }