{"id":19691955,"url":"https://github.com/yviscool/ex-press","last_synced_at":"2025-07-31T01:02:04.210Z","repository":{"id":143935298,"uuid":"265810879","full_name":"yviscool/ex-press","owner":"yviscool","description":"Web framework based on IoC and TypeScript","archived":false,"fork":false,"pushed_at":"2020-06-02T03:09:14.000Z","size":109,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-27T11:42:38.883Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yviscool.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-21T09:44:07.000Z","updated_at":"2020-06-02T03:09:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"3e6a2181-d241-4db9-8e94-fd6396b02f1b","html_url":"https://github.com/yviscool/ex-press","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yviscool/ex-press","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yviscool%2Fex-press","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yviscool%2Fex-press/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yviscool%2Fex-press/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yviscool%2Fex-press/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yviscool","download_url":"https://codeload.github.com/yviscool/ex-press/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yviscool%2Fex-press/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267972205,"owners_count":24174367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T19:11:59.908Z","updated_at":"2025-07-31T01:02:04.183Z","avatar_url":"https://github.com/yviscool.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ex-press\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![coverage][coverage-image]][coverage-url]\n\n[npm-image]: https://img.shields.io/npm/v/ex-press.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/ex-press\n[travis-image]: https://travis-ci.org/yviscool/ex-press.svg?branch=master\n[travis-url]: https://travis-ci.org/yviscool/ex-press\n[coverage-url]: https://coveralls.io/github/yviscool/ex-press\n[coverage-image]: https://coveralls.io/repos/github/yviscool/ex-press/badge.svg\n\nex-press is Node.js Web framework written by typescript, which uses IoC injection mechanism.\n\n## QuickStart\n\n\u003c!-- add docs here for user --\u003e\n\nsee [ex-press docs][express] for more detail.\n\n```js\nimport { Controller, Get, Post, Request, Body, Param, Del, Response, Provide, Inject } from 'ex-press';\nimport { UserService } from './service/user';\nimport { Response as Ctx } from 'express';\n\n@Provide()\n@Controller('/user')\nexport class UserController {\n\n  @Inject()\n  ctx: Ctx;\n\n  @Config('hello')\n  hello:string;\n\n  @Inject('userService')\n  userService: UserService\n\n  @Get('/')\n  async index(@Request() req) {\n    this.ctx.json(req.ip);\n  }\n\n  @Post('/')\n  async post(@Body() body, @Res() res) {\n    res.json(body);\n  }\n\n  @Get('/:id')\n  async getParam(@Param('id') id) {\n    return `get user ${id}`;\n  }\n\n  @Get('/service')\n  async service(@Param() param) {\n    const user = await this.userService.getUser();\n    return user;\n  }\n\n\n}\n```\n\n### Web middleware in router \n\nNow you can provide a middleware in you application (any directory)，such as src/app/middleware/api.ts.\n\n```js\nimport { Provide,  Config, WebMiddleware } from 'ex-press';\n\n@Provide()\nexport class ApiMiddleware implements WebMiddleware {\n\n    @Config('foo')\n    foo;\n\n    resolve(): any {\n        return (req, res, next) =\u003e {\n            req.api = this.foo;\n            next();\n        };\n    }\n\n}\n```\nuse \n\n```js\nimport { Controller, Get, Provide, Inject } from 'ex-press';\nimport { Response as Ctx } from 'express';\n\n@Provide()\n@Controller('/middleware', { middleware: ['apiMiddleware'] })\nexport class MiddlewareController {\n\n\n    @Inject()\n    ctx: Ctx;\n\n\n    @Get('/')\n    async index(@Request() req) {\n        this.ctx.send(req.api);\n    }\n\n    @Get('/part', { middleware: ['homeMiddleware'] })\n    async post(@Request() req) {\n        this.ctx.send(req.api + req.home);\n    }\n\n}\n\n```\n\n\n\n\n[express]: https://expressjs.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyviscool%2Fex-press","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyviscool%2Fex-press","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyviscool%2Fex-press/lists"}