Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.app.appCheckAny();
}
}
new MyController();
// service
class MyService extends Service {
async test() {
this.ctx.locals.test.serviceLocalCheckAny();
this.app.config.keys.serviceConfigCheckAny();
this.app.serviceAppCheckAny();
}
}
new MyService();
const app = new Application({ baseDir: __dirname, plugins: {}, type: 'application' });
new app.ContextHttpClient();
new app.HttpClient();
new Agent(undefined, 1123);
// test error in yadan
import {
BaseContextClass as YadanBaseContextClass,
Application as YadanApplication,
Agent as YadanAgent,
} from 'yadan';
new YadanBaseContextClass();
const yadan = new YadanApplication({ baseDir: __dirname, plugins: {}, type: 'application' });
new yadan.ContextHttpClient();
new yadan.HttpClient();
// custom base context class
class CustomBaseContextClass extends BaseContextClass {
constructor(ctx: Context) {
super(ctx);
}
test() {
this.logger.info(this.ctx);
this.logger.info(this.app.config.keys);
this.logger.info(this.ctx.curl('http://127.0.0.1', { method: 'GET' }));
}
}
new CustomBaseContextClass({} as Context).test();
// application
const app = new Application({ baseDir: __dirname, plugins: {}, type: 'application' });
app.logger.info('123');
app.middleware.slice(0);
app.name.substring(0);
app.on('egg-ready', () => {});
app.emit('egg-ready');
app.getLogger('test').info('123');
app.inspect();
app.listen(1002);
app.logger.info(app.locals.test);
const ctxHttpClient = new app.ContextHttpClient({} as Context);
ctxHttpClient.request('http://127.0.0.1', { method: 'GET' });
const appHttpClient = new app.HttpClient(app);
appHttpClient.request('http://127.0.0.1', { method: 'GET' });
app.httpclient.request('http://127.0.0.1', { method: 'GET' }).catch(() => {});
app.logger.info(app.Service);
app.logger.info(app.Controller);
target.prototype.run = function* () {
const options = {};
options.clusterPort = yield detectPort();
// before: ready
const Agent = egg.Agent;
const agent = new Agent(options);
yield agent.ready();
const app = new egg.Application(options);
yield app.ready();
// run
this.ctx = app.createAnonymousContext();
try {
yield this.helper.callFn(artisanRun, arguments, this);
} catch (err) {
yield agent.close();
yield app.close();
throw err;
}
// after: close
yield agent.close();
yield app.close();