{"id":30947662,"url":"https://github.com/yrobot/faas.js","last_synced_at":"2026-04-16T10:01:53.028Z","repository":{"id":312858151,"uuid":"1048539235","full_name":"Yrobot/FaaS.js","owner":"Yrobot","description":"一个 文件即服务的 docker 镜像，支持 js/ts","archived":false,"fork":false,"pushed_at":"2025-12-01T15:21:04.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-04T03:42:08.229Z","etag":null,"topics":["bun","docker","faas","javascript","typescript"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/yrobot/faas-js","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yrobot.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-01T15:49:06.000Z","updated_at":"2025-12-01T15:18:30.000Z","dependencies_parsed_at":"2025-09-02T13:28:01.769Z","dependency_job_id":"9847b6b4-b0c3-493d-8f07-16697deea526","html_url":"https://github.com/Yrobot/FaaS.js","commit_stats":null,"previous_names":["yrobot/faas.js"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Yrobot/FaaS.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yrobot%2FFaaS.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yrobot%2FFaaS.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yrobot%2FFaaS.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yrobot%2FFaaS.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yrobot","download_url":"https://codeload.github.com/Yrobot/FaaS.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yrobot%2FFaaS.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31880882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bun","docker","faas","javascript","typescript"],"created_at":"2025-09-11T02:00:47.584Z","updated_at":"2026-04-16T10:01:53.023Z","avatar_url":"https://github.com/Yrobot.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FaaS.(js/ts)\n\n\u003e 一个 文件即服务的 docker 镜像\n\n以 bun.sh 为基础环境，支持 js/ts 文件，以文件路径为请求路径，将 函数 以 服务的形式 进行暴露。\n\n`api/hi/index.(ts/js)` =\u003e `POST/GET/... /api/hi`\n\n- `api/hi/index.(ts/js)`\n\n```ts\nexport function GET(req: Request) {\n  return new Response(\"hello world\");\n}\n```\n\n## Quick Start\n\n```bash\ndocker run -d -p 3000:3000 --name faas-js \\\n  -v $DOCKER_DATA_DIR/faas-js/app:/app \\\n  -e POST=3000 \\\n  --user $(id -u):$(id -g) \\ # 推荐使用当前用户作为运行用户，这影响到文件权限 # 便于直接在此文件系统下debug和增加逻辑\n  ghcr.io/yrobot/faas-js:latest\n```\n\n### 在 `app/api` 下添加 ts 文件\n\n\u003e 文件 export 的 函数 需符合 Bun.serve 接口定义规范\n\u003e https://bun.com/docs/api/http#bun-serve\n\n- 支持 `@` 的 ts alias\n\n`util/time.ts`\n\n```ts\nimport dayjs from \"dayjs\";\n\nexport const getTime = () =\u003e dayjs().format(\"YYYY-MM-DD HH:mm:ss\");\n```\n\n`api/name/index.(ts/js)`\n\n```ts\nimport { getTime } from \"@/util/time\";\n\nexport function POST(req: Request) {\n  return Response.json({\n    name: \"FaaS.js\",\n    time: getTime(),\n  });\n}\n```\n\n## TODO\n\n### 支持 Dynamic Routes\n\n- `/api/xxx/:id`\n- `/api/:scope/:id`\n\n### 支持 Wildcard Routes\n\n- `/api/all/*`\n\n### 匹配优先级\n\n\u003e https://bun.com/docs/api/http#route-precedence\n\nRoutes are matched in order of specificity:\n\n1. Exact routes (/users/all)\n2. Parameter routes (/users/:id)\n3. Wildcard routes (/users/\\_)\n4. Global catch-all (/\\_)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyrobot%2Ffaas.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyrobot%2Ffaas.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyrobot%2Ffaas.js/lists"}