{"id":13452505,"url":"https://github.com/thiagobustamante/typescript-rest","last_synced_at":"2025-05-14T10:09:20.286Z","repository":{"id":9097135,"uuid":"60850483","full_name":"thiagobustamante/typescript-rest","owner":"thiagobustamante","description":"This is a lightweight annotation-based expressjs extension for typescript.","archived":false,"fork":false,"pushed_at":"2024-12-20T07:03:24.000Z","size":2372,"stargazers_count":524,"open_issues_count":72,"forks_count":109,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-04-03T19:10:00.476Z","etag":null,"topics":["api","decorators","es7-decorators","expressjs","microservice","rest","restful","service","typescript","typescript-rest"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thiagobustamante.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2016-06-10T13:41:47.000Z","updated_at":"2025-03-05T04:50:59.000Z","dependencies_parsed_at":"2023-11-14T18:36:00.878Z","dependency_job_id":"ead9b0f6-bfd8-4e07-8151-b9f5c5a96869","html_url":"https://github.com/thiagobustamante/typescript-rest","commit_stats":{"total_commits":350,"total_committers":27,"mean_commits":"12.962962962962964","dds":"0.17714285714285716","last_synced_commit":"43231cad663196888bc2ac1378dee7f323812527"},"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagobustamante%2Ftypescript-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagobustamante%2Ftypescript-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagobustamante%2Ftypescript-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagobustamante%2Ftypescript-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thiagobustamante","download_url":"https://codeload.github.com/thiagobustamante/typescript-rest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248337582,"owners_count":21087065,"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","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":["api","decorators","es7-decorators","expressjs","microservice","rest","restful","service","typescript","typescript-rest"],"created_at":"2024-07-31T07:01:26.027Z","updated_at":"2025-04-11T03:35:44.865Z","avatar_url":"https://github.com/thiagobustamante.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","typescript"],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/typescript-rest.svg)](https://badge.fury.io/js/typescript-rest)\n![Master Workflow](https://github.com/thiagobustamante/typescript-rest/workflows/Master%20Workflow/badge.svg)\n[![Coverage Status](https://codecov.io/gh/thiagobustamante/typescript-rest/branch/master/graph/badge.svg)](https://codecov.io/gh/thiagobustamante/typescript-rest)\n[![Known Vulnerabilities](https://snyk.io/test/github/thiagobustamante/typescript-rest/badge.svg?targetFile=package.json)](https://snyk.io/test/github/thiagobustamante/typescript-rest?targetFile=package.json)\n[![BCH compliance](https://bettercodehub.com/edge/badge/thiagobustamante/typescript-rest?branch=master)](https://bettercodehub.com/)\n\n# REST Services for Typescript\nThis is a lightweight annotation-based [expressjs](http://expressjs.com/) extension for typescript.\n\nIt can be used to define your APIs using decorators.\n\n**Table of Contents** \n\n- [REST Services for Typescript](#)\n  - [Installation](#installation)\n  - [Configuration](#configuration)\n  - [Basic Usage](#basic-usage)\n  - [Using with an IoC Container](#using-with-an-ioc-container)\n  - [Documentation](https://github.com/thiagobustamante/typescript-rest/wiki)\n  - [Boilerplate Project](#boilerplate-project)  \n\n## Installation\n\nThis library only works with typescript. Ensure it is installed:\n\n```bash\nnpm install typescript -g\n```\n\nTo install typescript-rest:\n\n```bash\nnpm install typescript-rest --save\n```\n\n## Configuration\n\nTypescript-rest requires the following TypeScript compilation options in your tsconfig.json file:\n\n```typescript\n{\n  \"compilerOptions\": {\n    \"experimentalDecorators\": true,\n    \"emitDecoratorMetadata\": true,\n    \"target\": \"es6\" // or anything newer like esnext\n  }\n}\n```\n\n## Basic Usage\n\n```typescript\nimport * as express from \"express\";\nimport {Server, Path, GET, PathParam} from \"typescript-rest\";\n\n@Path(\"/hello\")\nclass HelloService {\n  @Path(\":name\")\n  @GET\n  sayHello( @PathParam('name') name: string ): string {\n    return \"Hello \" + name;\n  }\n}\n\nlet app: express.Application = express();\nServer.buildServices(app);\n\napp.listen(3000, function() {\n  console.log('Rest Server listening on port 3000!');\n});\n\n```\n\nThat's it. You can just call now:\n\n```\nGET http://localhost:3000/hello/joe\n```\n\n## Using with an IoC Container\n\nInstall the IoC container and the serviceFactory for the IoC Container\n\n```bash\nnpm install typescript-rest --save\nnpm install typescript-ioc --save\nnpm install typescript-rest-ioc --save\n```\n\nThen add a rest.config file in the root of your project:\n\n```json\n{\n  \"serviceFactory\": \"typescript-rest-ioc\"\n}\n```\n\nAnd you can use Injections, Request scopes and all the features of the IoC Container. It is possible to use it with any other IoC Container, like Inversify.\n\nExample:\n\n```typescript\nclass HelloService {\n  sayHello(name: string) {\n    return \"Hello \" + name;\n  }\n}\n\n@Path(\"/hello\")\nclass HelloRestService {\n  @Inject\n  private helloService: HelloService;\n\n  @Path(\":name\")\n  @GET\n  sayHello( @PathParam('name') name: string): string {\n    return this.sayHello(name);\n  }\n}\n```\n\n## Complete Guide\n\nCheck our [documentation](https://github.com/thiagobustamante/typescript-rest/wiki).\n\n## Boilerplate Project\n\nYou can check [this project](https://github.com/vrudikov/typescript-rest-boilerplate) to get started.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagobustamante%2Ftypescript-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthiagobustamante%2Ftypescript-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagobustamante%2Ftypescript-rest/lists"}