{"id":19151723,"url":"https://github.com/zhs007/zexpress","last_synced_at":"2025-10-20T05:31:59.943Z","repository":{"id":57405743,"uuid":"46963924","full_name":"zhs007/zexpress","owner":"zhs007","description":"a better express","archived":false,"fork":false,"pushed_at":"2016-01-30T17:40:36.000Z","size":186,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-04T04:31:54.219Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zhs007.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}},"created_at":"2015-11-27T06:38:07.000Z","updated_at":"2016-01-30T07:40:51.000Z","dependencies_parsed_at":"2022-09-11T23:11:28.301Z","dependency_job_id":null,"html_url":"https://github.com/zhs007/zexpress","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/zhs007%2Fzexpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhs007%2Fzexpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhs007%2Fzexpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhs007%2Fzexpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhs007","download_url":"https://codeload.github.com/zhs007/zexpress/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240236361,"owners_count":19769580,"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-09T08:15:32.771Z","updated_at":"2025-10-20T05:31:59.877Z","avatar_url":"https://github.com/zhs007.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZExpress\nexpress框架是nodejs下最流行的web框架，ZExpress是在express进一步封装的一套web框架。\n\nZExpress其实类似express-generator，会生成一套空的项目。\n\n我们加了什么\n---\n* 我们将服务器返回统一处理了，支持4种通用返回，分别是空返回、页面跳转、ajax的json返回和普通的jade返回。\n* 我们对session做了进一步的封装。\n* 我们对jade做了缓存优化。\n* 我们对渲染参数做了统一封装。\n* 我们进一步规范了模块化开发规范。\n\n快速安装\n---\n直接npm全局安装即可。\n\n```\nnpm install zexpress -g\n```\n\n如何使用\n---\n创建项目需要一个js的配置文件。\n\n```\n// 项目名\nname = 'SlotsAdmin';\n\n// port\nport = 3600;\n\n// 项目标题\ntitle = '管理后台';\n\n// 数据库配置\ndbSlots = {host: '127.0.0.1', user: 'slots', password: 'slots123', database: 'slots3'};\ndbGamelog = {host: '127.0.0.1', user: 'slots', password: 'slots123', database: 'slots3'};\ndbmgr = {slots3: dbSlots, gamelog: dbGamelog};\n\n// 路由配置\nrouterIndex = {name: 'Index', url: '/', urlroot: '/', http: 'GET', type: 'simple', needlogin: 'true'};\nrouterLogin = {name: 'Login', url: '/', urlroot: '/login', http: 'GET', type: 'simple', needlogin: 'true'};\n\nacLogin = {name: 'Login', reqparam: ['name', 'password']};\nacLogout = {name: 'Logout'};\nrouterAdminCtrl = {name: 'AdminCtrl', url: '/', urlroot: '/adminctrl', type: 'ctrl', lstctrl: [\n    acLogin,\n    acLogout\n]};\n\nmcAddChild = {name: 'AddChild', reqparam: ['name', 'password', 'adminkey', 'gems']};\nmcChgPassword = {name: 'ChgPassword', reqparam: ['pid', 'password']};\nmcCleanChild = {name: 'CleanChild', reqparam: ['pid']};\nmcCleanPlayer = {name: 'CleanPlayer', reqparam: ['pid', 'childid']};\nmcCleanRoom = {name: 'CleanRoom', reqparam: ['roomid']};\nmcProcExchg = {name: 'ProcExchg', reqparam: ['exchgid', 'proc']};\nmcResetRoom = {name: 'ResetRoom', reqparam: ['roomid']};\nmcUpdChild = {name: 'UpdChild', reqparam: ['pid', 'password', 'adminkey', 'gems']};\nmcUpdNotice = {name: 'UpdNotice', reqparam: ['notice']};\nmcUpdRoom = {name: 'UpdRoom', reqparam: ['roomid', 'minper', 'maxper', 'playerminper', 'playermaxper']};\nmcUpdRoomEx = {name: 'UpdRoomEx', reqparam: ['roomid', 'curdiff']};\nrouterMainCtrl = {name: 'MainCtrl', url: '/', urlroot: '/mainctrl', type: 'ctrl', lstctrl: [\n    mcAddChild,\n    mcChgPassword,\n    mcCleanChild,\n    mcCleanPlayer,\n    mcCleanRoom,\n    mcProcExchg,\n    mcResetRoom,\n    mcUpdChild,\n    mcUpdNotice,\n    mcUpdRoom,\n    mcUpdRoomEx\n]};\n\nmodEdtChild = {name: 'EdtChild'};\nmodEdtRoom = {name: 'EdtRoom'};\nmodEdtRoomEx = {name: 'EdtRoomEx'};\nmodLeftMenu = {name: 'LeftMenu'};\nmodSysNotice = {name: 'SysNotice'};\nmodTotal = {name: 'Total'};\nmodViewChild = {name: 'ViewChild'};\nmodViewExchg = {name: 'ViewExchg'};\nmodViewPlayer = {name: 'ViewPlayer'};\nmodViewRoom = {name: 'ViewRoom'};\nrouterMain = {name: 'Main', url: ['/', '/:leftmenu/'], urlroot: '/main', type: 'module', needlogin: 'true', lstmodule: [\n    modEdtChild,\n    modEdtRoom,\n    modEdtRoomEx,\n    modLeftMenu,\n    modSysNotice,\n    modTotal,\n    modViewChild,\n    modViewExchg,\n    modViewPlayer,\n    modViewRoom\n]};\n\nrouter = [routerIndex, routerAdminCtrl, routerMainCtrl, routerLogin, routerMain];\n\n// 导出\nprojparam = {\n    projname: name,\n    port: port,\n    title: title,\n    dbmgr: dbmgr,\n    router: router\n};\n```\n\n这个配置文件里，配置了数据库、路由（基本页面、ajax请求、模块混合几种），最后，我们通过下面的指令生成项目\n\n```\nzrestify sample.js\ncd slotsadmin\nnpm install\n```\n\n就会在当前目录下生成一个名为 **slotsadmin** 的项目，并自动下载依赖库。\n\n如果我们要启动服务，可以使用下面的指令：\n\n```\nnode bin/slotsadmin.js\n```\n\n\n使用到的第三方库\n---\n\n* 使用 **[yargs](https://github.com/bcoe/yargs)** 模块简化命令行工具的开发。\n* 使用 **[zHandlebars](https://github.com/zhs007/zhandlebars)** 模板做项目生成模板。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhs007%2Fzexpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhs007%2Fzexpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhs007%2Fzexpress/lists"}