{"id":20144738,"url":"https://github.com/widuu/staticserver","last_synced_at":"2026-03-01T22:02:58.937Z","repository":{"id":15497452,"uuid":"18231348","full_name":"widuu/staticserver","owner":"widuu","description":"golang简单上传下载服务器演示","archived":false,"fork":false,"pushed_at":"2017-11-22T03:17:01.000Z","size":120,"stargazers_count":69,"open_issues_count":1,"forks_count":49,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T19:17:21.390Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.widuu.com","language":"Go","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/widuu.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":"2014-03-29T01:11:03.000Z","updated_at":"2024-06-18T14:44:47.000Z","dependencies_parsed_at":"2022-08-25T16:22:06.874Z","dependency_job_id":null,"html_url":"https://github.com/widuu/staticserver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/widuu/staticserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/widuu%2Fstaticserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/widuu%2Fstaticserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/widuu%2Fstaticserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/widuu%2Fstaticserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/widuu","download_url":"https://codeload.github.com/widuu/staticserver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/widuu%2Fstaticserver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29986241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T21:06:37.093Z","status":"ssl_error","status_checked_at":"2026-03-01T21:05:45.052Z","response_time":124,"last_error":"SSL_read: 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":[],"created_at":"2024-11-13T22:11:57.448Z","updated_at":"2026-03-01T22:02:58.914Z","avatar_url":"https://github.com/widuu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n###一百行golng代码写一个静态文件服务器\n\n####包含功能 \n\n1. 静态文件模板\n2. 文件上传\n3. 文件查看和下载\n\n####使用的包\n\n\timport (\n\t\t\"fmt\"\n\t\t\"html/template\"\n\t\t\"io\"\n\t\t\"net/http\"\n\t\t\"os\"\n\t\t\"path/filepath\"\n\t\t\"regexp\"\n\t\t\"strconv\"\n\t\t\"time\"\n\t)\n\n####包含知识点\n\n\t//静态文件服务器\n\thttp.FileServer(http.Dir(\"目录\"))\n\n\t//手工配置服务和路由\n\ts := \u0026http.Server{\n\t\tAddr:           \":8080\",\n\t\tHandler:        myHandler,\n\t\tReadTimeout:    10 * time.Second,\n\t\tWriteTimeout:   10 * time.Second,\n\t\tMaxHeaderBytes: 1 \u003c\u003c 20,\n\t}\n\n\ts.ListenAndServe();\n\n\t// path/filepath包的使用\n\n麻雀虽小，但是有很多基础知识点适合学习golang的朋友们一起玩\n\n###One hundred lines of code write a golang static server\n\n####Contains functions \n\n1. static file temlate \n2. upload file\n3. To view and download files\n\n####the use pkg\n\n\timport (\n\t\t\"fmt\"\n\t\t\"html/template\"\n\t\t\"io\"\n\t\t\"net/http\"\n\t\t\"os\"\n\t\t\"path/filepath\"\n\t\t\"regexp\"\n\t\t\"strconv\"\n\t\t\"time\"\n\t)\n\n####Contains the knowledge\n\n\t//static server\n\thttp.FileServer(http.Dir(\"目录\"))\n\n\t//Manually configure the service and routing\n\ts := \u0026http.Server{\n\t\tAddr:           \":8080\",\n\t\tHandler:        myHandler,\n\t\tReadTimeout:    10 * time.Second,\n\t\tWriteTimeout:   10 * time.Second,\n\t\tMaxHeaderBytes: 1 \u003c\u003c 20,\n\t}\n\n\ts.ListenAndServe();\n\n\t// path/filepath The use of the package \n\nThe sparrow is small, but there are a lot of basic knowledge for learning golang friends to play together\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiduu%2Fstaticserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwiduu%2Fstaticserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwiduu%2Fstaticserver/lists"}