{"id":18559198,"url":"https://github.com/linux-china/npm-export-spring-boot-starter","last_synced_at":"2025-04-10T02:30:41.555Z","repository":{"id":48298997,"uuid":"251121496","full_name":"linux-china/npm-export-spring-boot-starter","owner":"linux-china","description":"Spring Boot Starter to generate npm package to call REST API ","archived":false,"fork":false,"pushed_at":"2021-08-02T17:20:57.000Z","size":139,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T02:51:12.404Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/linux-china.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}},"created_at":"2020-03-29T19:57:02.000Z","updated_at":"2024-11-06T20:43:25.000Z","dependencies_parsed_at":"2022-08-30T15:01:26.083Z","dependency_job_id":null,"html_url":"https://github.com/linux-china/npm-export-spring-boot-starter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fnpm-export-spring-boot-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fnpm-export-spring-boot-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fnpm-export-spring-boot-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Fnpm-export-spring-boot-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linux-china","download_url":"https://codeload.github.com/linux-china/npm-export-spring-boot-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144158,"owners_count":21054876,"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":[],"created_at":"2024-11-06T21:42:17.392Z","updated_at":"2025-04-10T02:30:41.274Z","avatar_url":"https://github.com/linux-china.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"npm-export-spring-boot-starter\n==============================\n\nA Spring Boot starter, generates npm package for Node.js and Browser to call Spring Boot REST API.\n\n# Features\n\n* @NpmPackage(\"@UserService/UserController\") for Spring Boot Controller\n* Generate axios stub to call remote REST API\n* JSDoc support for code completion\n* index.d.ts generation for TypeScript\n* OpenAPI support\n* Package list: http://localhost/npm/packages\n\n# How to use?\n\n* Include dependency in your package.json and run \"yarn install\"\n\n```\n \"dependencies\": {\n    \"@UserService/UserController\": \"http://localhost:8080/npm/@UserService/UserController\"\n  }\n```\n\n* Call service api in your JS code:\n\n```\nconst userController = require(\"@UserService/UserController\").setBaseUrl(\"http://localhost:8080\");\n\n(async () =\u003e {\n    let nick = await userController.findNickById(1);\n    console.log(nick);\n})()\n```\n\n### OpenAPI Integration\n\n* @Operation\n* @ApiResponse\n\n```java\n@RestController\n@RequestMapping(\"/user\")\n@NpmPackage(\"@UserService/UserController\")\npublic class UserController {\n\n    @GetMapping(\"/user/schemaRaw/{id}\")\n    @ApiResponse(content = @Content(schema = @Schema(name = \"UserExtra\", requiredProperties = {\"first: string\", \"last: string\"})))\n    public Mono\u003cByteBuffer\u003e findUserByIdSchemaRaw(@PathVariable(\"id\") Integer id) {\n        return Mono.empty();\n    }\n\n    @GetMapping(\"/user/schemaBean/{id}\")\n    @ApiResponse(content = @Content(schema = @Schema(implementation = User.class)))\n    public Mono\u003cByteBuffer\u003e findUserByIdSchemaBean(@PathVariable(\"id\") Integer id) {\n        return Mono.empty();\n    }\n}\n```\n\n# Deno Integration\n\nIf you use Deno to run TypeScript, please use following code:\n\n```typescript\nimport  {userController } from \"http://localhost:8080/deno/UserService/mod.ts\"\n\nlet nick = await userController.findNickById(1)\n```\n\n# References\n\n* axios: Promise based HTTP client for the browser and node.js https://github.com/axios/axios\n* Apache Commons Compress: http://commons.apache.org/proper/commons-compress/\n* JSDoc 3: https://jsdoc.app/\n* SpringDoc OpenAPI: https://springdoc.org/\n* Fetch API: https://developer.mozilla.org/zh-CN/docs/Web/API/Fetch_API/Using_Fetch\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Fnpm-export-spring-boot-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinux-china%2Fnpm-export-spring-boot-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Fnpm-export-spring-boot-starter/lists"}