{"id":20064908,"url":"https://github.com/baidu/duedge-recipes","last_synced_at":"2025-08-02T01:10:31.090Z","repository":{"id":68133536,"uuid":"167345170","full_name":"baidu/duedge-recipes","owner":"baidu","description":"DuEdge百度边缘网络计算样例代码","archived":false,"fork":false,"pushed_at":"2020-03-13T10:53:01.000Z","size":401,"stargazers_count":27,"open_issues_count":0,"forks_count":15,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-05-05T18:35:56.863Z","etag":null,"topics":["duedge","edge","edge-computing"],"latest_commit_sha":null,"homepage":"https://duedge.baidu.com","language":"JavaScript","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/baidu.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":"2019-01-24T09:59:31.000Z","updated_at":"2023-12-28T09:55:08.000Z","dependencies_parsed_at":"2023-06-27T02:39:22.991Z","dependency_job_id":null,"html_url":"https://github.com/baidu/duedge-recipes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/baidu/duedge-recipes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidu%2Fduedge-recipes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidu%2Fduedge-recipes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidu%2Fduedge-recipes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidu%2Fduedge-recipes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baidu","download_url":"https://codeload.github.com/baidu/duedge-recipes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidu%2Fduedge-recipes/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268322414,"owners_count":24231819,"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-08-01T02:00:08.611Z","response_time":67,"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":["duedge","edge","edge-computing"],"created_at":"2024-11-13T13:48:11.422Z","updated_at":"2025-08-02T01:10:31.079Z","avatar_url":"https://github.com/baidu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DuEdge Recipes\n\n[duedge](https://duedge.baidu.com/) 为租户提供 FaaS(Serverless) 服务, 租户可以将功能函数运行在 Edge 端 (cdn 节点), 实现边缘计算应用场景.\n\n核心功能:\n\n- 可根据业务应用直接编写计算函数, 无需考虑服务器等基础资源的配置, 按实际计算量计费;\n- 遍布全国各地的超级计算中心, 支持各种网络线路的高速稳定连接, 为函数计算提供基础支持;\n- 自动为函数分配计算资源, 并根据网络连接情况为服务分配最优路径的边缘节点;\n\n\n此代码仓库旨在提供常见任务的示例, 包括:\n\n- About Log (如何记录 log)\n- About Cache (cache 相关操作)\n  - fetch (利用 fetch 回源)\n  - cache (操作本地缓存)\n- About KV\n  - global (全局只读 KV)\n  - string (机房内可读可写 KV, string 相关, get/set/setnx/incrby)\n  - bit (机房内可读可写 KV, bit 相关, getbit/setbit/bitcount)\n  - list (机房内可读可写 KV, list 相关, lpush/rpush/lpop/rpop/lrange/ltrim)\n- A/B Testing (根据 cookie 修改 uri 为 A/B 两种页面)\n- Redirecting Unauthenticated Users to a Sign-In Page (根据 cookie 情况重定向到登录页)\n- Aggregating Multiple Requests (合并多分请求结果)\n- Conditional Routing\n  - Device Type (不同设备类型, 访问不同页面)\n  - Custom Headers (使用特殊 header 替换 uri)\n- Custom responses that don’t hit origin servers\n  - Ignore POST And PUT HTTP Requests (忽略 POST/PUT 请求)\n  - Deny A Spider Or Crawler (拦截爬虫)\n  - Prevent A Specific IP From Connecting (根据 clinetIP 拦截)\n- Hot-link Protection (防盗链)\n- About Post Requests\n  - Read Post Data (获取 POST body)\n  - Create a Post Request (构造 POST 请求)\n- Random Content Cookies (构造 cookie)\n- Signed Requests\n  - Generating Signed Requests (生成签名)\n  - Verifying Signed Requests (验证签名)\n- Normalizing Query String Parameters to Improve the Cache Hit Ratio (参数排序, 提高缓存命中率)\n- Rewrite request uri and Updating Error Statuses\n  - Rewrite request uri (改写请求)\n  - Update the Error Status Code to 302-Found (重定向异常响应)\n- About AI\n  - Call face detect example (调用人脸检测)\n  - Call image censor example (调用图像审核)\n  - Call antiporn example (调用色情识别)\n  - Call terror censor example (调用暴恐识别)\n  - Call politician censor example (调用政治人物)\n  - Prevent uploading erotic image (防止上传色情图片)\n  - Prevent access to erotic image (防止用户访问色情图片)\n\n\n## 快速开始\n\n在 [duedge](https://duedge.baidu.com) 官网接入域名, 绑定 `Hello World` 函数, 符合 `route` 规则的请求均会返回 200 / Hello DuEdge!\n\n### node\n\n```js\nasync function f(event) {\n    return {status: 200, body: 'Hello DuEdge!'};\n}\nexports.handler = f;\n```\n\n### python\n\n```python\nasync def handler(event):\n    return {'status': 201, 'body': 'Hello DuEdge!'}\n```\n\n### lua\n\n```lua\nlocal _M = {}\n\nfunction _M.handler(event)\n    return {status = 200, body = 'Hello DuEdge!'}\nend\n\nreturn _M\n```\n\n## 测试\n\n代码编辑页面支持在线测试函数调用, 通过请求触发函数需要域名正式接入 duedge;\n\n\n## 如何贡献\n\n我们欢迎**使用/修改/拓展**这些, 如果你有更好的使用场景, 直接提交 **PR** 即可;\n\n\n## 讨论\n\n[官网帮助中心](https://duedge.baidu.com/help/#/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaidu%2Fduedge-recipes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaidu%2Fduedge-recipes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaidu%2Fduedge-recipes/lists"}