├── test ├── lib │ ├── plugins │ │ ├── empty.txt │ │ ├── static.test.js │ │ ├── depd.test.js │ │ ├── onerror.test.js │ │ ├── logrotator.test.js │ │ └── schedule.test.js │ ├── core │ │ ├── config │ │ │ └── config.test.js │ │ ├── loader │ │ │ ├── load_router.test.js │ │ │ └── load_app.test.js │ │ ├── context_httpclient.test.js │ │ └── httpclient_tracer_demo.test.js │ └── cluster │ │ ├── cluster-client-error.test.js │ │ └── app_worker.test.js ├── fixtures │ ├── apps │ │ ├── view-render │ │ │ ├── app │ │ │ │ ├── a.js │ │ │ │ ├── view │ │ │ │ │ ├── a.html │ │ │ │ │ ├── shtml.html │ │ │ │ │ ├── sjs.html │ │ │ │ │ ├── xss.html │ │ │ │ │ ├── index.html │ │ │ │ │ ├── inject.html │ │ │ │ │ ├── form_csrf.html │ │ │ │ │ ├── locals.html │ │ │ │ │ └── nonce.html │ │ │ │ ├── controller │ │ │ │ │ ├── csrf.js │ │ │ │ │ ├── empty.js │ │ │ │ │ ├── nonce.js │ │ │ │ │ ├── home.js │ │ │ │ │ ├── inject.js │ │ │ │ │ ├── sjs.js │ │ │ │ │ ├── context.js │ │ │ │ │ ├── locals.js │ │ │ │ │ ├── string.js │ │ │ │ │ ├── xss.js │ │ │ │ │ ├── shtml.js │ │ │ │ │ └── async.js │ │ │ │ ├── extend │ │ │ │ │ └── helper.js │ │ │ │ └── router.js │ │ │ ├── package.json │ │ │ └── config │ │ │ │ ├── plugin.js │ │ │ │ └── config.default.js │ │ ├── i18n │ │ │ ├── config │ │ │ │ ├── locales │ │ │ │ │ ├── xx.txt │ │ │ │ │ ├── zh-CN.js │ │ │ │ │ └── de.json │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ ├── package.json │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ ├── view │ │ │ │ └── home.html │ │ │ │ └── controller │ │ │ │ ├── home.js │ │ │ │ └── message.js │ │ ├── middlewares │ │ │ ├── app │ │ │ │ ├── crossdomain.xml │ │ │ │ ├── robots.txt │ │ │ │ ├── controller │ │ │ │ │ ├── error.js │ │ │ │ │ └── home.js │ │ │ │ └── router.js │ │ │ ├── server.conf │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── watcher-development-app │ │ │ ├── tmp.txt │ │ │ ├── tmp │ │ │ │ └── tmp.txt │ │ │ ├── tmp-agent.txt │ │ │ ├── tmp-agent │ │ │ │ └── tmp.txt │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.unittest.js │ │ │ ├── agent.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── app-ts │ │ │ ├── .gitignore │ │ │ ├── config │ │ │ │ └── config.ts │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ ├── router.ts │ │ │ │ ├── service │ │ │ │ │ └── foo.ts │ │ │ │ └── controller │ │ │ │ │ └── foo.ts │ │ │ └── tsconfig.json │ │ ├── loader-plugin │ │ │ ├── config │ │ │ │ ├── map.json │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ ├── node_modules │ │ │ │ ├── d │ │ │ │ │ ├── .gitkeep │ │ │ │ │ ├── package.json │ │ │ │ │ └── config │ │ │ │ │ │ └── config.js │ │ │ │ ├── rds │ │ │ │ │ ├── .gitkeep │ │ │ │ │ └── package.json │ │ │ │ ├── a │ │ │ │ │ ├── app │ │ │ │ │ │ ├── proxy │ │ │ │ │ │ │ └── a.js │ │ │ │ │ │ └── service │ │ │ │ │ │ │ └── bar1.js │ │ │ │ │ ├── config │ │ │ │ │ │ └── config.js │ │ │ │ │ ├── package.json │ │ │ │ │ └── app.js │ │ │ │ ├── b │ │ │ │ │ ├── config │ │ │ │ │ │ ├── antx.dev.properties │ │ │ │ │ │ ├── antx.test.properties │ │ │ │ │ │ ├── antx.prod.properties │ │ │ │ │ │ ├── antx.unittest.properties │ │ │ │ │ │ └── antx.default.properties │ │ │ │ │ ├── package.json │ │ │ │ │ ├── app.js │ │ │ │ │ └── app │ │ │ │ │ │ └── service │ │ │ │ │ │ └── bar2.js │ │ │ │ ├── c │ │ │ │ │ ├── package.json │ │ │ │ │ ├── config │ │ │ │ │ │ └── config.js │ │ │ │ │ └── app.js │ │ │ │ └── a1 │ │ │ │ │ └── package.json │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ ├── service │ │ │ │ │ ├── foo2.js │ │ │ │ │ ├── foo3 │ │ │ │ │ │ └── foo3.js │ │ │ │ │ ├── foo.js │ │ │ │ │ ├── Foo4.js │ │ │ │ │ └── fooDir │ │ │ │ │ │ └── Foo5.js │ │ │ │ └── router.js │ │ │ ├── plugins │ │ │ │ ├── f │ │ │ │ │ └── package.json │ │ │ │ ├── g │ │ │ │ │ └── package.json │ │ │ │ └── e │ │ │ │ │ └── package.json │ │ │ └── app.js │ │ ├── multiple-view-engine │ │ │ ├── app │ │ │ │ ├── view │ │ │ │ │ ├── ext │ │ │ │ │ │ ├── a.ejs │ │ │ │ │ │ └── a.nj │ │ │ │ │ └── loader │ │ │ │ │ │ ├── a.ejs │ │ │ │ │ │ ├── a.html │ │ │ │ │ │ ├── a.noext │ │ │ │ │ │ └── a.nj.ejs │ │ │ │ ├── view2 │ │ │ │ │ └── loader │ │ │ │ │ │ ├── a.nj │ │ │ │ │ │ └── from-view2.ejs │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ │ └── view.js │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.unittest.js │ │ │ │ └── config.default.js │ │ │ ├── app.js │ │ │ ├── nunjucks.js │ │ │ └── ejs.js │ │ ├── logger-output-json │ │ │ ├── config │ │ │ │ ├── map.json │ │ │ │ └── config.default.js │ │ │ └── package.json │ │ ├── worker-die │ │ │ ├── app.js │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── development │ │ │ ├── app │ │ │ │ ├── public │ │ │ │ │ └── foo.js │ │ │ │ └── router.js │ │ │ ├── config │ │ │ │ ├── plugin.js │ │ │ │ └── config.default.js │ │ │ └── package.json │ │ ├── static-server │ │ │ ├── app │ │ │ │ └── public │ │ │ │ │ └── foo.js │ │ │ ├── config │ │ │ │ ├── plugin.js │ │ │ │ └── config.default.js │ │ │ └── package.json │ │ ├── demo │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ ├── home.js │ │ │ │ │ ├── hello.js │ │ │ │ │ ├── foo.js │ │ │ │ │ ├── ip.js │ │ │ │ │ └── logger.js │ │ │ │ └── router.js │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── docapp │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ └── middleware │ │ │ │ └── koastatic.js │ │ ├── empty │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── helper │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ └── home.js │ │ │ │ └── router.js │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── locals │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── app │ │ │ │ └── helper.js │ │ │ └── app.js │ │ ├── logger │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.unittest.js │ │ │ │ ├── config.local.js │ │ │ │ └── config.default.js │ │ │ ├── agent.js │ │ │ └── app.js │ │ ├── mock-production-app │ │ │ ├── config │ │ │ │ ├── map.json │ │ │ │ ├── config.unittest.js │ │ │ │ └── config.js │ │ │ └── package.json │ │ ├── router-app │ │ │ ├── app │ │ │ │ ├── view │ │ │ │ │ └── locals │ │ │ │ │ │ └── router.html │ │ │ │ ├── controller │ │ │ │ │ ├── locals.js │ │ │ │ │ ├── members.js │ │ │ │ │ └── posts.js │ │ │ │ └── router.js │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── app-die │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── package.json │ │ │ └── app │ │ │ │ └── router.js │ │ ├── favicon │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ └── home.js │ │ │ │ └── router.js │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── notfound │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── notready │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ └── a │ │ │ │ ├── package.json │ │ │ │ └── app.js │ │ ├── onerror │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.unittest.js │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ ├── user.js │ │ │ │ └── home.js │ │ ├── response │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── package.json │ │ │ └── app │ │ │ │ └── router.js │ │ ├── schedule │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ └── schedule │ │ │ │ └── sub │ │ │ │ └── cron.js │ │ ├── secure-app │ │ │ ├── config │ │ │ │ ├── plugin.js │ │ │ │ ├── config.default.js │ │ │ │ └── config.unittest.js │ │ │ ├── package.json │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ └── index.js │ │ ├── agent-app │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ ├── plugins │ │ │ │ └── mock-client │ │ │ │ │ ├── config │ │ │ │ │ └── config.default.js │ │ │ │ │ └── agent.js │ │ │ ├── app.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── agent-die │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── agent.js │ │ │ └── start.js │ │ ├── agent-throw │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── config.unittest.js │ │ │ ├── package.json │ │ │ ├── agent.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── aliyun-egg │ │ │ ├── package.json │ │ │ ├── agent.js │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ ├── app.js │ │ │ ├── index.js │ │ │ └── lib │ │ │ │ ├── plugins │ │ │ │ └── custom │ │ │ │ │ ├── agent.js │ │ │ │ │ └── app.js │ │ │ │ ├── agent.js │ │ │ │ └── aliyun-egg.js │ │ ├── app-router │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ ├── controller │ │ │ │ └── home.js │ │ │ │ └── router.js │ │ ├── app-server │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── app │ │ │ │ └── router.js │ │ │ └── app.js │ │ ├── app-throw │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── config.unittest.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── async-app │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── app │ │ │ │ ├── router.js │ │ │ │ ├── middleware │ │ │ │ │ ├── async.js │ │ │ │ │ └── router.js │ │ │ │ ├── schedule │ │ │ │ │ └── async.js │ │ │ │ ├── controller │ │ │ │ │ └── api.js │ │ │ │ └── service │ │ │ │ │ └── api.js │ │ │ └── app.js │ │ ├── csrf-enable │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── config.unittest.js │ │ │ └── app │ │ │ │ ├── controller │ │ │ │ └── api.js │ │ │ │ └── router.js │ │ ├── csrf-ignore │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.unittest.js │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ ├── controller │ │ │ │ └── api.js │ │ │ │ └── router.js │ │ ├── dumpconfig │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app.js │ │ ├── encrypt-cookies │ │ │ ├── config │ │ │ │ ├── plugin.js │ │ │ │ └── config.default.js │ │ │ ├── package.json │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ └── home.js │ │ ├── get-logger │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ └── router.js │ │ │ └── config │ │ │ │ └── config.js │ │ ├── koa-session │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── package.json │ │ │ └── app │ │ │ │ ├── controller │ │ │ │ ├── clear.js │ │ │ │ └── home.js │ │ │ │ └── router.js │ │ ├── logger-level-debug │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── messenger │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── app.js │ │ │ └── agent.js │ │ ├── mock-dev-app │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── package.json │ │ ├── multipart │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ ├── controller │ │ │ │ ├── home.js │ │ │ │ └── upload.js │ │ │ │ ├── router.js │ │ │ │ └── view │ │ │ │ └── home.html │ │ ├── service-app │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ ├── controller │ │ │ │ └── user.js │ │ │ │ └── service │ │ │ │ └── user.js │ │ ├── tracer-demo │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── app.js │ │ │ ├── agent.js │ │ │ ├── app │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ │ └── home.js │ │ │ └── tracer.js │ │ ├── agent-restart │ │ │ ├── package.json │ │ │ ├── client.js │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── app.js │ │ │ └── agent.js │ │ ├── aliyun-egg-app │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── package.json │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ └── home.js │ │ ├── app-locals-getter │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── package.json │ │ │ └── app │ │ │ │ └── router.js │ │ ├── csrf-disable │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ │ └── api.js │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── custom-logger │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── keys-exists │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── package.json │ │ ├── keys-missing │ │ │ └── package.json │ │ ├── loader-plugin-dep │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ └── plugins │ │ │ │ ├── d │ │ │ │ └── package.json │ │ │ │ ├── e │ │ │ │ └── package.json │ │ │ │ ├── f │ │ │ │ └── package.json │ │ │ │ ├── a │ │ │ │ └── package.json │ │ │ │ ├── b │ │ │ │ └── package.json │ │ │ │ └── c │ │ │ │ └── package.json │ │ ├── logger-reload │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ └── home.js │ │ ├── mock-production-app-do-not-force │ │ │ ├── config │ │ │ │ ├── map.json │ │ │ │ ├── config.unittest.js │ │ │ │ └── config.js │ │ │ └── package.json │ │ ├── override_method │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── package.json │ │ │ └── app │ │ │ │ └── router.js │ │ ├── reload-worker │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ ├── controller │ │ │ │ │ ├── home.js │ │ │ │ │ └── home1.js │ │ │ │ └── router.js │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── agent-app-sync │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── app │ │ │ │ └── router.js │ │ │ ├── agent.js │ │ │ └── app.js │ │ ├── agent-client-app │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── app.js │ │ │ ├── agent.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── aliyun-egg-biz │ │ │ ├── package.json │ │ │ └── index.js │ │ ├── cluster_mod_app │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── lib │ │ │ │ ├── api_client.js │ │ │ │ └── api_client_2.js │ │ │ ├── app │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ │ └── home.js │ │ │ ├── agent.js │ │ │ └── app.js │ │ ├── ctx-background │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── config.unittest.js │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ ├── home.js │ │ │ │ ├── app.js │ │ │ │ └── error.js │ │ ├── custom-env-app │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── logrotator-app │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ └── router.js │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── messenger-random │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── app.js │ │ │ └── agent.js │ │ ├── nobuffer-logger │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── singleton-demo │ │ │ ├── package.json │ │ │ ├── app.js │ │ │ ├── agent.js │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── create.js │ │ ├── subdir-services │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ ├── service │ │ │ │ ├── old_style.js │ │ │ │ ├── ok.js │ │ │ │ ├── user.js │ │ │ │ ├── foo │ │ │ │ │ ├── subdir2 │ │ │ │ │ │ └── sub2.js │ │ │ │ │ ├── bar.js │ │ │ │ │ ├── subdir1 │ │ │ │ │ │ └── subdir11 │ │ │ │ │ │ │ └── bar.js │ │ │ │ │ └── subdir │ │ │ │ │ │ └── bar.js │ │ │ │ ├── cif │ │ │ │ │ └── user.js │ │ │ │ └── certify-personal │ │ │ │ │ └── mobile-hi │ │ │ │ │ └── do_certify.js │ │ │ │ └── controller │ │ │ │ └── home.js │ │ ├── app-start-timeout │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── config.unittest.js │ │ │ └── app.js │ │ ├── base-context-class │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ ├── service │ │ │ │ └── home.js │ │ │ │ └── controller │ │ │ │ └── home.js │ │ ├── close-watcher-logrotator │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ └── package.json │ │ ├── context-config-app │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ ├── router.js │ │ │ │ ├── extend │ │ │ │ │ └── context.js │ │ │ │ └── controller │ │ │ │ │ └── home.js │ │ │ └── config │ │ │ │ ├── config.js │ │ │ │ └── config.local.js │ │ ├── context_httpclient │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── dump-ignore-error │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── httpclient-tracer │ │ │ ├── package.json │ │ │ ├── app.js │ │ │ └── config │ │ │ │ └── plugin.js │ │ ├── watcher-type-default │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.unittest.js │ │ ├── body_parser_testapp │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── cluster-client-error │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app.js │ │ ├── dnscache_httpclient │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.unittest.js │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ └── home.js │ │ ├── httpclient-overwrite │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app.js │ │ ├── loader-plugin-noexist │ │ │ ├── package.json │ │ │ └── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ ├── master-worker-started │ │ │ ├── node_modules │ │ │ │ └── egg │ │ │ │ │ ├── package.json │ │ │ │ │ └── index.js │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── dispatch.js │ │ ├── messenger-app-agent │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── app.js │ │ │ └── agent.js │ │ ├── messenger-broadcast │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ ├── app.js │ │ │ └── agent.js │ │ ├── notfound-custom-404 │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── querystring-extended │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ ├── router.js │ │ │ │ └── controller │ │ │ │ │ └── home.js │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── confused-configuration │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── loader-plugin-dep-missing │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ └── plugins │ │ │ │ ├── a │ │ │ │ └── package.json │ │ │ │ ├── b │ │ │ │ └── package.json │ │ │ │ └── c │ │ │ │ └── package.json │ │ ├── loader-plugin-dep-recursive │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ ├── config.default.js │ │ │ │ └── plugin.js │ │ │ └── plugins │ │ │ │ ├── a │ │ │ │ └── package.json │ │ │ │ ├── b │ │ │ │ └── package.json │ │ │ │ └── c │ │ │ │ └── package.json │ │ ├── services_loader_verify │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ └── service │ │ │ │ └── foo.js │ │ ├── app-server-with-hostname │ │ │ ├── package.json │ │ │ ├── app │ │ │ │ └── router.js │ │ │ └── config │ │ │ │ └── config.default.js │ │ ├── body_parser_testapp_ignore │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── body_parser_testapp_match │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── custom-context-getlogger │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ ├── router.js │ │ │ │ ├── extend │ │ │ │ └── context.js │ │ │ │ └── controller │ │ │ │ └── home.js │ │ ├── body_parser_testapp_disable │ │ │ ├── package.json │ │ │ ├── config │ │ │ │ └── config.default.js │ │ │ └── app │ │ │ │ └── router.js │ │ ├── httpclient-agent-timeout-3000 │ │ │ ├── package.json │ │ │ └── config │ │ │ │ └── config.default.js │ │ └── httpclient-request-timeout-100 │ │ │ ├── package.json │ │ │ └── config │ │ │ └── config.default.js │ └── custom-egg │ │ ├── package.json │ │ └── index.js ├── async │ ├── index.test.js │ └── _async.js ├── index.test.js ├── app │ ├── middleware │ │ └── meta.test.js │ └── extend │ │ └── agent.test.js ├── doc.test.js └── ts │ └── index.test.js ├── docs ├── source │ ├── zh-cn │ │ ├── index.md │ │ ├── plugins │ │ │ └── index.md │ │ ├── resource.md │ │ ├── basics │ │ │ └── app-start.md │ │ └── tutorials │ │ │ └── index.md │ ├── en │ │ └── plugins │ │ │ └── index.md │ └── _data │ │ ├── menu.yml │ │ └── links.yml ├── assets │ ├── egg-logo.png │ ├── egg-framework.png │ ├── communication-seq.png │ ├── quickstart-index.png │ └── quickstart-coverage.png └── _config.yml ├── config ├── favicon.png ├── config.local.js └── config.unittest.js ├── .eslintignore ├── scripts ├── deploy_key.enc ├── commits.sh └── doc_travis.sh ├── app ├── middleware │ ├── body_parser.js │ ├── override_method.js │ ├── meta.js │ ├── site_file.js │ └── notfound.js └── extend │ └── helper.js ├── .eslintrc ├── lib ├── jsdoc │ ├── response.jsdoc │ ├── request.jsdoc │ └── context.jsdoc ├── loader │ ├── index.js │ ├── agent_worker_loader.js │ └── app_worker_loader.js └── core │ ├── base_context_class.js │ ├── logger.js │ └── context_httpclient.js ├── appveyor.yml ├── .travis.yml ├── .gitignore ├── .autod.conf.js ├── .github ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE.md └── LICENSE /test/lib/plugins/empty.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/a.js: -------------------------------------------------------------------------------- 1 | aaa -------------------------------------------------------------------------------- /docs/source/zh-cn/index.md: -------------------------------------------------------------------------------- 1 | layout: index 2 | --- 3 | -------------------------------------------------------------------------------- /test/fixtures/apps/i18n/config/locales/xx.txt: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/middlewares/app/crossdomain.xml: -------------------------------------------------------------------------------- 1 | xxx -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/view/a.html: -------------------------------------------------------------------------------- 1 | aaa -------------------------------------------------------------------------------- /test/fixtures/apps/watcher-development-app/tmp.txt: -------------------------------------------------------------------------------- 1 | aaa -------------------------------------------------------------------------------- /test/fixtures/apps/app-ts/.gitignore: -------------------------------------------------------------------------------- 1 | *.js 2 | node_modules -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/config/map.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/d/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/rds/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/multiple-view-engine/app/view/ext/a.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/multiple-view-engine/app/view/ext/a.nj: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/watcher-development-app/tmp/tmp.txt: -------------------------------------------------------------------------------- 1 | aaa -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/a/app/proxy/a.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger-output-json/config/map.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/middlewares/server.conf: -------------------------------------------------------------------------------- 1 | zone = RZ01B 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/multiple-view-engine/app/view/loader/a.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/multiple-view-engine/app/view/loader/a.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/multiple-view-engine/app/view/loader/a.noext: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/multiple-view-engine/app/view2/loader/a.nj: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/watcher-development-app/tmp-agent.txt: -------------------------------------------------------------------------------- 1 | bbb -------------------------------------------------------------------------------- /test/fixtures/apps/watcher-development-app/tmp-agent/tmp.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/worker-die/app.js: -------------------------------------------------------------------------------- 1 | throw new Error('dddd'); -------------------------------------------------------------------------------- /test/fixtures/apps/development/app/public/foo.js: -------------------------------------------------------------------------------- 1 | alert('bar'); 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/a/app/service/bar1.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/multiple-view-engine/app/view/loader/a.nj.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/static-server/app/public/foo.js: -------------------------------------------------------------------------------- 1 | alert('bar'); 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/docapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docapp" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/empty/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "empty" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/helper/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "helper" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/i18n/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "i18n" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/locals/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "locals" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "logger" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/mock-production-app/config/map.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/multiple-view-engine/app/view2/loader/from-view2.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/apps/router-app/app/view/locals/router.html: -------------------------------------------------------------------------------- 1 | posts: /posts -------------------------------------------------------------------------------- /test/fixtures/apps/app-die/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-die/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-die" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/development/config/plugin.js: -------------------------------------------------------------------------------- 1 | exports.static = true; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/favicon/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "favicon" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/locals/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/notfound/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "notfound" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/notready/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "notready" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/onerror/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "onerror" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/response/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'f' 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/response/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "response" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/router-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "router-app" 3 | } -------------------------------------------------------------------------------- /test/fixtures/apps/schedule/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "schedule" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/secure-app/config/plugin.js: -------------------------------------------------------------------------------- 1 | exports.security = false; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/static-server/config/plugin.js: -------------------------------------------------------------------------------- 1 | exports.static = true; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/view/shtml.html: -------------------------------------------------------------------------------- 1 | {{helper.shtml(foo)}} 2 | -------------------------------------------------------------------------------- /test/fixtures/custom-egg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "custom-egg" 3 | } 4 | -------------------------------------------------------------------------------- /docs/source/en/plugins/index.md: -------------------------------------------------------------------------------- 1 | layout: plugin 2 | title: Plugin List 3 | --- 4 | -------------------------------------------------------------------------------- /docs/source/zh-cn/plugins/index.md: -------------------------------------------------------------------------------- 1 | layout: plugin 2 | title: 内置插件列表 3 | --- 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/agent-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agent-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/agent-die/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agent-die" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/agent-throw/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/agent-throw/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agent-throw" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/aliyun-egg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aliyun-egg" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-router/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-router" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-server" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-throw/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-throw" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/async-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "async-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-enable/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "csrf-enable" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-ignore/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "csrf-ignore" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/development/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/development/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "development" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/dumpconfig/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dumpconfig" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/encrypt-cookies/config/plugin.js: -------------------------------------------------------------------------------- 1 | exports.security = false; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/get-logger/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "get-logger" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/koa-session/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/koa-session/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "koa-session" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger-level-debug/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/messenger/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "messenger" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/middlewares/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "middlewares" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/mock-dev-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'd'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/multipart/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multipart" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/secure-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "secure-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/service-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "service-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/static-server/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/tracer-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tracer-demo" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "view-render" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/worker-die/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "worker-die" 3 | } 4 | -------------------------------------------------------------------------------- /config/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/egg/master/config/favicon.png -------------------------------------------------------------------------------- /test/fixtures/apps/agent-restart/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agent-restart" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/aliyun-egg-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-locals-getter/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-server/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'my keys'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-ts/config/config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | keys: 'foo', 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-disable/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "csrf-disable" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/custom-logger/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "custom-logger" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/encrypt-cookies/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/keys-exists/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'my keys'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/keys-missing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "keys-missing" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "plugin-dep" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "loader-plugin" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger-reload/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "logger-reload" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/mock-dev-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mock-dev-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/mock-production-app-do-not-force/config/map.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/override_method/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/reload-worker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reload-worker" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/view/sjs.html: -------------------------------------------------------------------------------- 1 | var foo = "{{ helper.sjs(foo) }}"; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/agent-app-sync/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agent-app-sync" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/agent-client-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agent-client-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/aliyun-egg-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aliyun-egg-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/aliyun-egg-biz/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aliyun-egg-biz" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/cluster_mod_app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cluster_mod_app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/ctx-background/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ctx-background" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/custom-env-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "custom-env-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/encrypt-cookies/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "encrypt-cookies" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/keys-exists/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "keys-missing-local" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/a/config/config.js: -------------------------------------------------------------------------------- 1 | exports.pluginA = 1; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/logrotator-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "logrotator-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/messenger-random/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "messenger-random" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/nobuffer-logger/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nobuffer-logger" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/override_method/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "override_method" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/singleton-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "singleton-demo" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/subdir-services/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "subdir-services" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/watcher-development-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "watcher-app" 3 | } -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | test/fixtures 2 | examples/**/app/public 3 | logs 4 | run 5 | docs/node_modules 6 | -------------------------------------------------------------------------------- /scripts/deploy_key.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/egg/master/scripts/deploy_key.enc -------------------------------------------------------------------------------- /test/fixtures/apps/agent-restart/client.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ready: cb => cb(), 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-locals-getter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-locals-getter" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-start-timeout/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-start-timeout" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-ts", 3 | "version": "1.0.0" 4 | } -------------------------------------------------------------------------------- /test/fixtures/apps/base-context-class/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "base-context-class" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/close-watcher-logrotator/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/context-config-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "context-config-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/context_httpclient/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "context_httpclient" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/dump-ignore-error/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dump-ignore-error" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/httpclient-tracer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "httpclient-tracer" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger-output-json/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "logger-output-json" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/watcher-type-default/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "watcher-type-default" 3 | } -------------------------------------------------------------------------------- /app/middleware/body_parser.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('koa-bodyparser'); 4 | -------------------------------------------------------------------------------- /app/middleware/override_method.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('koa-override'); 4 | -------------------------------------------------------------------------------- /docs/assets/egg-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/egg/master/docs/assets/egg-logo.png -------------------------------------------------------------------------------- /test/fixtures/apps/body_parser_testapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "body_parser_testapp" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/cluster-client-error/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cluster-client-error" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/dnscache_httpclient/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dnscache_httpclient-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/empty/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/httpclient-overwrite/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "httpclient-overwrite" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-noexist/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "loader-plugin-noexist" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/b/config/antx.dev.properties: -------------------------------------------------------------------------------- 1 | key.name = pluginDev 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/b/config/antx.test.properties: -------------------------------------------------------------------------------- 1 | key.name = pluginTest 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/master-worker-started/node_modules/egg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/master-worker-started/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "master-worker-started" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/messenger-app-agent/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "messenger-app-agent" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/messenger-broadcast/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "messenger-broadcast" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/mock-production-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mock-production-app" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/multiple-view-engine/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multiple-view-engine" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/notfound-custom-404/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "notfound-custom-404" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/querystring-extended/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "querystring-extended" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/agent-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/agent-die/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/aliyun-egg/agent.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = agent => { 4 | 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/aliyun-egg/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-router/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-throw/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/confused-configuration/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "confused-configuration" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-enable/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'foo'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/ctx-background/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'foo'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/custom-env-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'foo'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep-missing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "plugin-dep-missing" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep-recursive/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "plugin-dep-recursive" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/messenger/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/notready/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/schedule/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/secure-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | exports.proxy = true; 3 | -------------------------------------------------------------------------------- /test/fixtures/apps/services_loader_verify/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "services_loader_verify" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/worker-die/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/custom-egg/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('../../../index'); 4 | -------------------------------------------------------------------------------- /docs/assets/egg-framework.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/egg/master/docs/assets/egg-framework.png -------------------------------------------------------------------------------- /test/fixtures/apps/agent-app-sync/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/agent-restart/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/aliyun-egg-biz/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('../aliyun-egg'); 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-server-with-hostname/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-server-with-hostname" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/body_parser_testapp_ignore/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "body_parser_testapp_ignore" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/body_parser_testapp_match/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "body_parser_testapp_match" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/close-watcher-logrotator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "close-watcher-logrotator" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/custom-context-getlogger/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "custom-context-getlogger" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/b/config/antx.prod.properties: -------------------------------------------------------------------------------- 1 | key.name = pluginProd 2 | a = 1 3 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/b/config/antx.unittest.properties: -------------------------------------------------------------------------------- 1 | key.name = pluginUnittest 2 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger-reload/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/nobuffer-logger/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/reload-worker/app/controller/home.js: -------------------------------------------------------------------------------- 1 | module.exports = function*() { this.body = 'change'; }; -------------------------------------------------------------------------------- /test/fixtures/apps/reload-worker/app/controller/home1.js: -------------------------------------------------------------------------------- 1 | module.exports = function*() { this.body = 'change'; }; -------------------------------------------------------------------------------- /test/fixtures/apps/reload-worker/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/service-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/subdir-services/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /docs/assets/communication-seq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/egg/master/docs/assets/communication-seq.png -------------------------------------------------------------------------------- /docs/assets/quickstart-index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/egg/master/docs/assets/quickstart-index.png -------------------------------------------------------------------------------- /test/fixtures/apps/agent-client-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/base-context-class/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test keys'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/body_parser_testapp_disable/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "body_parser_testapp_disable" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/cluster-client-error/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/context_httpclient/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/custom-context-getlogger/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'foo'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/dumpconfig/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.dynamic = 0; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/app/service/foo2.js: -------------------------------------------------------------------------------- 1 | module.exports = function*() { 2 | return 'foo2'; 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/messenger-app-agent/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/messenger-broadcast/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/messenger-random/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/tracer-demo/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'tracer-demo keys'; 4 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint-config-egg", 3 | "parserOptions": { 4 | "ecmaVersion": 2017 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /docs/assets/quickstart-coverage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/functions/egg/master/docs/assets/quickstart-coverage.png -------------------------------------------------------------------------------- /test/fixtures/apps/agent-die/agent.js: -------------------------------------------------------------------------------- 1 | 2 | setTimeout(() => { 3 | throw new Error('app worker throw'); 4 | }, 5000); 5 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-router/app/controller/home.js: -------------------------------------------------------------------------------- 1 | module.exports = function* () { 2 | this.body = 'hello'; 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-start-timeout/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.workerStartTimeout = 1000; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/close-watcher-logrotator/config/plugin.js: -------------------------------------------------------------------------------- 1 | exports.logrotator = false; 2 | exports.watcher = false; 3 | -------------------------------------------------------------------------------- /test/fixtures/apps/dump-ignore-error/config/config.default.js: -------------------------------------------------------------------------------- 1 | 2 | exports.dump = null; 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/helper/app/controller/home.js: -------------------------------------------------------------------------------- 1 | module.exports = function* () { 2 | this.body = 'hello home'; 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/httpclient-agent-timeout-3000/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "httpclient-agent-timeout-3000" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/httpclient-request-timeout-100/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "httpclient-request-timeout-100" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep-missing/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep/plugins/d/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "d" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep/plugins/e/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "e" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep/plugins/f/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "f" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-noexist/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/app/service/foo3/foo3.js: -------------------------------------------------------------------------------- 1 | module.exports = function*() { 2 | return 'foo3'; 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "a" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "b" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "c" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/d/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "d1" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/master-worker-started/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/notready/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a", 3 | "eggPlugin": { 4 | "name": "a" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/service-app/app/router.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | app.get('user', '/user', 'user'); 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/services_loader_verify/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /lib/jsdoc/response.jsdoc: -------------------------------------------------------------------------------- 1 | /** 2 | * 继承 koa 的 Response 3 | * @class Response 4 | * @see http://koajs.com/#response 5 | */ 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/aliyun-egg/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app['aliyun-egg'] = {}; 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/encrypt-cookies/app/router.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | app.get('/', app.controller.home); 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep-missing/plugins/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "a" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep-missing/plugins/b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "b" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep-missing/plugins/c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "c" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep-recursive/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'test key'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/rds/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "rds" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/locals/app/helper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.test = () => { 4 | return 'test-helper'; 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger-reload/app/router.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | app.get('/', app.controller.home); 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/mock-production-app-do-not-force/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mock-production-app-do-not-force" 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/notready/a/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.readyCallback('a'); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/subdir-services/app/router.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | app.get('/', app.controller.home); 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/subdir-services/app/service/old_style.js: -------------------------------------------------------------------------------- 1 | exports.url = function* (ctx) { 2 | return ctx.url; 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/view/xss.html: -------------------------------------------------------------------------------- 1 | {{ url }} 2 | {{ url | safe }} 3 | {{ helper.surl(url) }} 4 | {{ html }} 5 | -------------------------------------------------------------------------------- /test/fixtures/apps/context-config-app/app/router.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | app.get('home', '/', 'home.index'); 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep-recursive/plugins/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "a" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep-recursive/plugins/b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "b" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep-recursive/plugins/c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "c" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-noexist/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | noexist: true 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/middlewares/app/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: Baiduspider 2 | Disallow: / 3 | 4 | User-agent: baiduspider 5 | Disallow: / -------------------------------------------------------------------------------- /test/fixtures/apps/onerror/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/querystring-extended/app/router.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | app.get('/', app.controller.home); 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/static-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "static-server", 3 | "spm": { 4 | "less": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/tracer-demo/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | require('./tracer')(app); 5 | }; 6 | -------------------------------------------------------------------------------- /config/config.local.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | coreLogger: { 5 | consoleLevel: 'WARN', 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/agent-throw/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-throw/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/context-config-app/config/config.js: -------------------------------------------------------------------------------- 1 | exports.security = { 2 | csrf: false 3 | } 4 | 5 | exports.keys = 'foo'; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-enable/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-ignore/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/plugins/f/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "f", 3 | "eggPlugin": { 4 | "name": "f" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/middlewares/app/controller/error.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function*() { 4 | foo.bar; 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/secure-app/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/tracer-demo/agent.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = agent => { 4 | require('./tracer')(agent); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/tracer-demo/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/', 'home.index'); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/controller/csrf.js: -------------------------------------------------------------------------------- 1 | module.exports = function*() { 2 | yield this.render('form_csrf.html'); 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/controller/empty.js: -------------------------------------------------------------------------------- 1 | module.exports = function* () { 2 | yield this.render('index.html'); 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/controller/nonce.js: -------------------------------------------------------------------------------- 1 | module.exports = function*() { 2 | yield this.render('nonce.html'); 3 | }; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-start-timeout/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/async-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'key'; 4 | exports.middleware = [ 'async' ]; 5 | -------------------------------------------------------------------------------- /test/fixtures/apps/context-config-app/config/config.local.js: -------------------------------------------------------------------------------- 1 | 'use stirct'; 2 | 3 | exports.logger = { 4 | stdoutLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/ctx-background/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/favicon/app/controller/home.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function*() { 4 | this.body = 'home'; 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/favicon/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/', app.controller.home); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep/plugins/a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "a", 3 | "eggPlugin": { 4 | "name": "a" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep/plugins/b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "b", 3 | "eggPlugin": { 4 | "name": "b" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin-dep/plugins/c/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "c1", 3 | "eggPlugin": { 4 | "name": "c1" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/plugins/g/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "g", 4 | "dep": [ "f" ] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/master-worker-started/node_modules/egg/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('../../../../../..'); 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/aliyun-egg-app/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/', app.controller.home); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/context-config-app/app/extend/context.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | foo: 1, 3 | bar: function() { 4 | return 2; 5 | } 6 | }; -------------------------------------------------------------------------------- /test/fixtures/apps/custom-context-getlogger/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/', 'home'); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/dnscache_httpclient/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/d/config/config.js: -------------------------------------------------------------------------------- 1 | // exports.proxy = { 2 | // 3 | // }; 4 | // 5 | // exports.middleware = ['d']; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger-output-json/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.logger = { 2 | outputJSON: true, 3 | }; 4 | 5 | exports.keys = 'f'; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/middlewares/app/controller/home.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function*() { 4 | this.body = 'home'; 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/mock-production-app/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/multiple-view-engine/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/reload-worker/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/', app.controller.home); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/demo/app/controller/home.js: -------------------------------------------------------------------------------- 1 | module.exports = function* () { 2 | this.body = { 3 | workerTitle: process.title 4 | }; 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/dnscache_httpclient/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/', app.controller.home); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/i18n/config/locales/zh-CN.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'Email': '邮箱', 3 | 'Hello %s, how are you today?': '%s,今天过得如何?', 4 | }; 5 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.date = Date.now(); 5 | app.app = 'app'; 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/b/config/antx.default.properties: -------------------------------------------------------------------------------- 1 | key.name = pluginDefault 2 | ; 覆盖默认的 3 | app.protocol = http 4 | a = 1 5 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/c/config/config.js: -------------------------------------------------------------------------------- 1 | exports.name = 'override default'; 2 | 3 | exports.plugin = 'overridden by app'; 4 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/plugins/e/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "wrong-name", 4 | "dep": [ "f" ] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/notfound-custom-404/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.notfound = { 2 | pageUrl: '/404', 3 | }; 4 | 5 | exports.keys = 'foo'; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/controller/home.js: -------------------------------------------------------------------------------- 1 | module.exports = function* () { 2 | yield this.render('index.html', {name: 'mk・2'}); 3 | }; 4 | -------------------------------------------------------------------------------- /config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | logger: { 5 | consoleLevel: 'WARN', 6 | buffer: false, 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /test/fixtures/apps/koa-session/app/controller/clear.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = function* () { 3 | this.session = null; 4 | this.body = 'clear'; 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger/config/config.local.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | logger: { 5 | consoleLevel: 'INFO', 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/mock-production-app-do-not-force/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | consoleLevel: 'NONE', 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/notfound/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.notfound = { 2 | pageUrl: 'https://eggjs.org/404', 3 | }; 4 | 5 | exports.keys = 'foo'; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/controller/inject.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function *(){ 4 | yield this.render('inject.html'); 5 | }; -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.nunjucks = { 4 | enable: true, 5 | package: 'egg-view-nunjucks', 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-router/app/router.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | app.get('home', '/', 'home'); 3 | app.get('/home', app.controller.home); 4 | }; 5 | -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-disable/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.post('/api/user', app.controller.api.user); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/router-app/app/controller/locals.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.router = function* () { 4 | yield this.render('locals/router.html'); 5 | }; -------------------------------------------------------------------------------- /test/fixtures/apps/app-server/app/router.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | app.get('/', function* () { 3 | this.body = this.app.serverEmit; 4 | }); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/async-app/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/api', app.middlewares.router(), 'api.index'); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/cluster_mod_app/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = 'foo'; 2 | 3 | exports.security = { 4 | csrf: { 5 | enable: false, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/favicon/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.siteFile = { 2 | '/favicon.ico': 'https://eggjs.org/favicon.ico', 3 | } 4 | 5 | exports.keys = 'foo'; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.plugin = 'override plugin'; 2 | 3 | exports.middleware = []; 4 | 5 | exports.keys = 'test key'; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/view/index.html: -------------------------------------------------------------------------------- 1 | Hi, {{name}} 2 | test-app-helper: {{helper.test('bar')}} 3 | raw: {{helper.test_safe('dar')}} 4 | {{copyright}} 5 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-server/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.on('server', server => { 5 | app.serverEmit = true; 6 | }); 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/httpclient-overwrite/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.httpclient = { 4 | request: { 5 | timeout: 100, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/i18n/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.view = { 4 | defaultViewEngine: 'nunjucks', 5 | }; 6 | 7 | exports.keys = 'test key'; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger-level-debug/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.logger = { 4 | level: 'DEBUG', 5 | }; 6 | 7 | exports.keys = 'test key'; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/secure-app/app/router.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | app.get('/user.json', app.jsonp(), 'index.getUser'); 3 | app.get('/', 'index.home'); 4 | }; 5 | -------------------------------------------------------------------------------- /test/fixtures/apps/demo/app/controller/hello.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function*() { 4 | this.cookies.set('hi', 'foo'); 5 | this.body = 'hello'; 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/httpclient-tracer/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | const done = app.readyCallback('ready'); 5 | setTimeout(done, 5000); 6 | }; -------------------------------------------------------------------------------- /test/fixtures/apps/koa-session/app/router.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = app => { 3 | app.get('/', app.controller.home); 4 | app.get('/clear', app.controller.clear); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/a/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(app) { 4 | app.dateA = Date.now(); 5 | app.a = 'plugin a'; 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/b/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(app) { 4 | app.dateB = Date.now(); 5 | app.b = 'plugin b'; 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/c/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(app) { 4 | app.dateC = Date.now(); 5 | app.c = 'plugin c'; 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/logrotator-app/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/', function*() { 5 | this.body = 123; 6 | }); 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/multipart/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.multipart = { 4 | fileExtensions: ['.foo'], 5 | }; 6 | 7 | exports.keys = 'foo,key'; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/notfound-custom-404/app/router.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | app.get('/404', function*() { 3 | this.body = 'Hi, this is 404'; 4 | }); 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/service-app/app/controller/user.js: -------------------------------------------------------------------------------- 1 | module.exports = function* () { 2 | this.body = { 3 | user: yield this.service.user.get('123'), 4 | }; 5 | }; 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/watcher-type-default/config/config.unittest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.watcher = { 4 | type: 'default', 5 | }; 6 | 7 | exports.keys = 'test key'; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/agent-app-sync/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/', function*() { 5 | this.body = this.app.arg; 6 | }) 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/body_parser_testapp/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.bodyParser = { 2 | queryString: { 3 | arrayLimit: 5 4 | } 5 | }; 6 | 7 | exports.keys = 'foo'; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/cluster-client-error/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | const err = Error(); 5 | err.name = 'MockError'; 6 | throw err; 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/httpclient-request-timeout-100/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.httpclient = { 4 | request: { 5 | timeout: 100, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/httpclient-tracer/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | tracer: { 5 | enable: true, 6 | package: 'egg-tracer', 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /test/fixtures/apps/onerror/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.onerror = { 4 | errorPageUrl: 'http://eggjs.org/500', 5 | }; 6 | 7 | exports.keys = 'foo'; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/dnscache_httpclient/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.httpclient = { 4 | enableDNSCache: true, 5 | }; 6 | 7 | exports.keys = 'test key'; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/node_modules/a1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "eggPlugin": { 3 | "name": "a1", 4 | "dep": [ "d1" ], 5 | "env": [ "local", "prod" ] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/logger/agent.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = agent => { 4 | agent.logger.info('agent info'); 5 | agent.logger.error(new Error('agent error')); 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-server-with-hostname/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/', function* () { 5 | this.body = 'done'; 6 | }); 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-disable/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'fo'; 4 | 5 | exports.security = { 6 | csrf: false, 7 | debug: 'csrf-disable', 8 | }; 9 | -------------------------------------------------------------------------------- /test/fixtures/apps/i18n/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/', app.controller.home); 5 | app.get('/message', app.controller.message); 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/middlewares/app/router.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = app => { 4 | app.get('/', app.controller.home); 5 | app.get('/error', app.controller.error); 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/notready/config/plugin.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | 5 | exports.a = { 6 | enable: true, 7 | path: path.join(__dirname, '../a'), 8 | } 9 | -------------------------------------------------------------------------------- /test/fixtures/apps/querystring-extended/app/controller/home.js: -------------------------------------------------------------------------------- 1 | module.exports = function* () { 2 | this.body = { 3 | query: this.query, 4 | queries: this.queries, 5 | }; 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/controller/sjs.js: -------------------------------------------------------------------------------- 1 | module.exports = function* () { 2 | var view = 'sjs.html'; 3 | yield this.render(view, { 4 | foo: '"hello"' 5 | }); 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/app-start-timeout/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(app) { 4 | const done = app.readyCallback('app-timeout'); 5 | setTimeout(done, 30000); 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/router-app/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'my'; 4 | 5 | exports.security = { 6 | csrf: { 7 | enable: false, 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-enable/app/controller/api.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.user = function* () { 4 | this.body = { 5 | url: this.url, 6 | name: this.query.name, 7 | }; 8 | }; 9 | -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-ignore/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.keys = 'foo'; 4 | 5 | exports.security = { 6 | csrf: { 7 | ignore: /^\/api\//, 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /test/fixtures/apps/docapp/config/config.default.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | 5 | module.exports = { 6 | keys: 'test key', 7 | middleware: [ 'koastatic' ], 8 | }; 9 | -------------------------------------------------------------------------------- /test/fixtures/apps/loader-plugin/app/service/foo.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (app) { 4 | class Foo extends app.Service { 5 | 6 | } 7 | 8 | return Foo; 9 | }; 10 | -------------------------------------------------------------------------------- /test/fixtures/apps/view-render/app/view/inject.html: -------------------------------------------------------------------------------- 1 | ctx: {{ ctx != undefined }} 2 | request: {{ request != undefined }} 3 | helper: {{ helper != undefined }} 4 | helperFn: {{ helper.test != undefined }} -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-disable/app/controller/api.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.user = function* () { 4 | this.body = { 5 | url: this.url, 6 | name: this.request.body.name, 7 | }; 8 | }; 9 | -------------------------------------------------------------------------------- /test/fixtures/apps/csrf-ignore/app/controller/api.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | exports.user = function* () { 4 | this.body = { 5 | url: this.url, 6 | name: this.request.body.name, 7 | }; 8 | }; 9 | -------------------------------------------------------------------------------- /test/fixtures/apps/i18n/app/view/home.html: -------------------------------------------------------------------------------- 1 |
config.notfound.pageUrl(${options.pageUrl}) is unimplemented`;
26 | return;
27 | }
28 |
29 | if (options.pageUrl) {
30 | this.realStatus = 404;
31 | this.redirect(options.pageUrl);
32 | return;
33 | }
34 | this.body = notFoundHtml;
35 | };
36 | };
37 |
--------------------------------------------------------------------------------
/test/lib/cluster/cluster-client-error.test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const fs = require('fs');
4 | const path = require('path');
5 | const assert = require('assert');
6 | const sleep = require('mz-modules/sleep');
7 | const utils = require('../../utils');
8 |
9 | describe('test/lib/cluster/cluster-client-error.test.js', () => {
10 | let app;
11 | before(function* () {
12 | app = utils.app('apps/cluster-client-error');
13 |
14 | let err;
15 | try {
16 | yield app.ready();
17 | } catch (e) {
18 | err = e;
19 | }
20 | assert(err);
21 | });
22 |
23 | it('should close even if app throw error', () => {
24 | return app.close();
25 | });
26 |
27 | it('should follower not throw error', function* () {
28 | yield sleep(1000);
29 | const cnt = fs.readFileSync(path.join(__dirname, '../../fixtures/apps/cluster-client-error/logs/cluster-client-error/common-error.log'), 'utf8');
30 | assert(!cnt.includes('ECONNRESET'));
31 | });
32 |
33 | });
34 |
--------------------------------------------------------------------------------
/test/lib/core/context_httpclient.test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const assert = require('assert');
4 | const utils = require('../../utils');
5 |
6 | describe('test/lib/core/context_httpclient.test.js', () => {
7 | let url;
8 | let app;
9 |
10 | before(() => {
11 | app = utils.app('apps/context_httpclient');
12 | return app.ready();
13 | });
14 | before(function* () {
15 | url = yield utils.startLocalServer();
16 | });
17 |
18 | it('should send request with ctx.httpclient', function* () {
19 | const ctx = app.mockContext();
20 | const httpclient = ctx.httpclient;
21 | assert(ctx.httpclient === httpclient);
22 | assert(httpclient.ctx === ctx);
23 | assert(typeof httpclient.request === 'function');
24 | assert(typeof httpclient.curl === 'function');
25 | const result = yield ctx.httpclient.request(url);
26 | assert(result.status === 200);
27 | const result2 = yield ctx.httpclient.curl(url);
28 | assert(result2.status === 200);
29 | });
30 | });
31 |
--------------------------------------------------------------------------------
/test/fixtures/apps/agent-client-app/app/router.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = function(app) {
4 | const done = app.readyCallback('app_subscribe_data');
5 | app.subClient.subscribe('mock-data', val => {
6 | app.mockData = val;
7 | done();
8 | });
9 |
10 | const done1 = app.readyCallback('app_subscribe_not_exist_data');
11 | app.subClient.subscribe('not-exist-data', val => {
12 | app.notExistData = val;
13 | done1();
14 | });
15 |
16 | app.get('/', function*() {
17 | const val = yield cb => app.subClient.subscribe('mock-data', val => {
18 | cb(null, val);
19 | });
20 |
21 | this.body = {
22 | 'mock-data': val,
23 | 'app-mock-data': app.mockData,
24 | };
25 | });
26 |
27 | app.get('/not-exist', function*() {
28 | const val = yield cb => app.subClient.subscribe('not-exist-data', val => {
29 | cb(null, val);
30 | });
31 |
32 | this.body = {
33 | 'not-exist-data': null,
34 | 'app-not-exist-data': null,
35 | };
36 | });
37 | };
38 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
18 |
19 | * **Node Version**:
20 | * **Egg Version**:
21 | * **Plugin Name**:
22 | * **Plugin Version**:
23 | * **Platform**:
24 | * **Mini Showcase Repository**:
25 |
26 |
27 |
--------------------------------------------------------------------------------
/lib/jsdoc/context.jsdoc:
--------------------------------------------------------------------------------
1 | /**
2 | * 继承 koa 的 Context
3 | * @class Context
4 | * @see http://koajs.com/#context
5 | */
6 |
7 | /**
8 | * 实现页面跳转
9 | * @see Response#redirect
10 | * @method Context#redirect
11 | * @param {String} url 需要跳转的地址
12 | */
13 |
14 | /**
15 | * 开启 {@link Rest} 功能后,将会有 `this.params` 对象
16 | * @member {Object} Context#params
17 | * @example
18 | * ##### ctx.params.id {String}
19 | *
20 | * 资源 id,如 `GET /api/users/1` => `'1'`
21 | *
22 | * ##### ctx.params.ids {Array