{"id":21016101,"url":"https://github.com/protontype/protontype","last_synced_at":"2025-05-15T05:32:28.300Z","repository":{"id":57331836,"uuid":"65865167","full_name":"protontype/protontype","owner":"protontype","description":"A simple Nodejs framework made in Typescript to build REST APIs","archived":false,"fork":false,"pushed_at":"2018-09-06T14:22:54.000Z","size":697,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-05-12T00:46:01.976Z","etag":null,"topics":["espressjs","express","nodejs","protontype","rest","rest-api","server","typeorm","typescript"],"latest_commit_sha":null,"homepage":"https://protontype.github.io/","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/protontype.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-17T01:14:51.000Z","updated_at":"2023-05-16T15:55:00.000Z","dependencies_parsed_at":"2022-09-05T10:11:52.913Z","dependency_job_id":null,"html_url":"https://github.com/protontype/protontype","commit_stats":null,"previous_names":["linck/protontype-api"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protontype%2Fprotontype","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protontype%2Fprotontype/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protontype%2Fprotontype/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protontype%2Fprotontype/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/protontype","download_url":"https://codeload.github.com/protontype/protontype/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254282316,"owners_count":22045123,"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":["espressjs","express","nodejs","protontype","rest","rest-api","server","typeorm","typescript"],"created_at":"2024-11-19T10:12:11.968Z","updated_at":"2025-05-15T05:32:27.929Z","avatar_url":"https://github.com/protontype.png","language":"TypeScript","readme":"[Português](README.md) / **English**\n# ProtonType \n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://protontype.github.io/\"\u003e\n    \u003cimg src=\"https://avatars1.githubusercontent.com/u/34164645?s=200\u0026v=4\"\u003e\n  \u003c/a\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n\t\u003ca href=\"https://travis-ci.org/protontype/protontype\"\u003e\n\t\t\u003cimg src=\"https://travis-ci.org/protontype/protontype.svg?branch=develop\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/protontype\"\u003e\n\t\t\u003cimg src=\"https://badge.fury.io/js/protontype.svg\"\u003e\n\t\u003c/a\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n\u003c/div\u003e\n\nA simple framework made with TypeScript.\n\nBuild your Nodejs APIs with Classes, Methods, Annotations, ORM ...\n\n## Documentation\n- [Full documentation](https://protontype.github.io/)\n\n## Instalation\n```bash\nnpm install protontype --save\n```\n \n## Models\nUses [TypeORM](http://typeorm.io/#/) by default database manipulation. But any framework can be used.\n\n```typescript\n@Entity()\nexport class TasksModel {\n    @PrimaryGeneratedColumn()\n    id: number;\n    @Column({ nullable: true })\n    title: string;\n    @Column()\n    done: boolean;\n    @Column()\n    userId: number;\n}\n```\n## Middlewares\nSupports middlewares implementation\n\n```typescript\nexport class TasksMiddleware extends BaseMiddleware {\n    @Middleware()\n    printTaskTitle(params: MiddlewareFunctionParams) {\n        cosole.log(params.req.body.title);\n        params.next();\n    }\n}\n```\n\n## Router\nCRUD basic routes already implemented in ```CrudRouter```\n\n```typescript\n @RouterClass({\n    baseUrl: \"/tasks\",\n    model: TasksModel,\n    middlewares: [new TasksMiddleware()]\n})\nexport class TasksRouter extends CrudRouter {\n    /*\n    GET / - Lists all records\n    POST / - Creates a records\n    GET /:id - Queries a records\n    PUT /:id - Updates a records\n    DELETE /:id - Removes a records\n    */\n\n    //New custom routes ....\n}\n```\nOr can implements custom routes\n```typescript\n @RouterClass({\n    baseUrl: \"/tasks\",\n    model: TasksModel,\n    middlewares: [new TasksMiddleware()]\n})\nexport class TasksRouter extends BaseRouter {\n    @Route({\n        endpoint: '/test/msg',\n        method: Method.GET,\n        middlewares: [new OtherMiddleware()]\n    })\n    routeTest(params: RouterFunctionParams) {\n        console.log(\"Hello!\");\n    }\n}\n```\n\n## Database manipulation\n```typescript\nlet tasksRepository = TypeORMDB.getBD().getRepository(TasksModel);\nlet tasks = await tasksRepository.find();\n``` \n\n## Starting application\n\n```typescript\nnew ProtonApplication()\n    .addRouterAs(TasksRouter)\n    .addMiddlewareAs(SomeoneGlobalMiddleware)\n    .start();\n```\n\n## Examples\n- [Basic example](https://github.com/protontype/protontype-sample)\n\n- [Sequelize module example](https://github.com/protontype/protontype-sequelize-sample)\n\n## Development version\n```bash\nnpm install protontype@dev --save\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotontype%2Fprotontype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprotontype%2Fprotontype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotontype%2Fprotontype/lists"}