{"id":17141780,"url":"https://github.com/zmofei/dufing","last_synced_at":"2025-04-13T10:23:50.575Z","repository":{"id":16095515,"uuid":"18840331","full_name":"zmofei/dufing","owner":"zmofei","description":"The faster way built your website with node.js","archived":false,"fork":false,"pushed_at":"2017-09-13T13:00:47.000Z","size":8221,"stargazers_count":36,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T18:51:46.549Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/zmofei.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-04-16T13:19:53.000Z","updated_at":"2024-10-25T10:34:12.000Z","dependencies_parsed_at":"2022-08-04T07:46:42.713Z","dependency_job_id":null,"html_url":"https://github.com/zmofei/dufing","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/zmofei%2Fdufing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmofei%2Fdufing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmofei%2Fdufing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmofei%2Fdufing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zmofei","download_url":"https://codeload.github.com/zmofei/dufing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248696500,"owners_count":21147125,"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-10-14T20:27:04.273Z","updated_at":"2025-04-13T10:23:50.549Z","avatar_url":"https://github.com/zmofei.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dufing - A folder system based Node.js webserver\n\n--------------------------------------------------------------------------------\n\nDufing 是一个基于文件系统的Node.js webserver, 他可以自动根据文件结构读取router文件，同时支持第三方middleware。\n\n## 文档\n\n[中文文档](https://zmofei.gitbooks.io/dufing/content/)\n\n\n## 安装\n\n```\nnpm install --save dufing\n```\n\n## 快速上手\n\n#### 1. app.js\n\n```JavaScript\n/**\n * app.js\n * 使用dufing只需简单的require，然后实例化即可\n */\n\n'use strict';\n\nlet Dufing = require('dufing');\n\nlet site = new Dufing({\n    // 指定端口 默认端口是8124\n    port: 8333\n});\n```\n\n#### 2. root/index.js\n\n```JavaScript\n/**\n * root/index.js\n * 默认情况下 root 为代码的根目录\n * 访问 127.0.0.1:8333/ 系统会自动的查找 `root/index.js`\n * 具体的路由规则，详见路由模块的介绍\n */\n\nvar render = function() {\n    // this.req 相当于请求的request\n    // this.res 相当于请求的response\n    this.res.writeHead(200, {\n        'Content-Type': 'text/plain'\n    });\n    this.res.end('welcome to dufing');\n}\n\n// module.exports 将需要执行的代码块抛给dufing处理\nmodule.exports = render;\n```\n\n#### 3. static/\\*.\\*\n\n默认情况下，static为静态资源目录，所有符合规则的静态资源都会被直接读取到。\n\n比如访问\n\n`http://hostname/test.js` 系统会尝试访问 `static/test.js` 如果不存在返回404\n\n## 示例\n[朱文龙的自留地](http://www.zhuwenlong.com) ([代码](https://github.com/zmofei/myblog))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmofei%2Fdufing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzmofei%2Fdufing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmofei%2Fdufing/lists"}