{"id":22695749,"url":"https://github.com/acmenlei/node-backend-template","last_synced_at":"2025-04-13T03:24:24.205Z","repository":{"id":104298837,"uuid":"331225060","full_name":"acmenlei/node-backend-template","owner":"acmenlei","description":"A node.js based server template.","archived":false,"fork":false,"pushed_at":"2023-08-14T00:18:55.000Z","size":1161,"stargazers_count":23,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T20:21:43.557Z","etag":null,"topics":["crypto","express","jwt","mysql","nodejs","redis","sequelize","sql"],"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/acmenlei.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,"governance":null}},"created_at":"2021-01-20T07:20:26.000Z","updated_at":"2025-03-05T17:48:06.000Z","dependencies_parsed_at":"2023-08-14T02:02:52.618Z","dependency_job_id":null,"html_url":"https://github.com/acmenlei/node-backend-template","commit_stats":null,"previous_names":["acmenlei/node-backend-template"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acmenlei%2Fnode-backend-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acmenlei%2Fnode-backend-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acmenlei%2Fnode-backend-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acmenlei%2Fnode-backend-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acmenlei","download_url":"https://codeload.github.com/acmenlei/node-backend-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248658456,"owners_count":21140947,"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":["crypto","express","jwt","mysql","nodejs","redis","sequelize","sql"],"created_at":"2024-12-10T04:11:52.517Z","updated_at":"2025-04-13T03:24:24.183Z","avatar_url":"https://github.com/acmenlei.png","language":"JavaScript","readme":"#### 1. 项目介绍\n`vue-admin-top`后台管理系统和`next--ssr-blog`的服务端, `Node`编写, 需要配合那两个项目食用, 算是比较详细的模块拆分, 带权限处理+数据中台, 可以学习练手。\n`MySQL`+`Redis`做数据存储, `jwt`+`crypto-js`做用户登录校验\n\n\u003e Api文档查看请在服务启动后访问http://localhost:9001/docs\n\n#### 2. 模块介绍\n- Api文档: `/docs`\n- 鉴权模块(jwt\u0026crypto-js\u0026cookie\u0026session): `src/authentication`\n- 公共逻辑处理(tip/alioss/可视化数据处理): `src/common`\n- 拦截器逻辑处理: `src/intercepter`\n- 定时任务: `src/schedule`\n- 公共逻辑处理(tip/alioss/可视化数据处理): `src/common`\n- 过滤拦截器白名单: `src/whiteList`\n- 数据库模型: `src/models`\n- 管理系统路由接口: `src/routes`\n- 前端路由接口: `src/receptionRoutes`\n- 入口文件: `src/index`\n- 权限相关逻辑处理: `src/permission`\n\n#### 配置跨域\n在入口文件(`index.js`)中,找到以下内容\n```js\napp.use(cors({\n    origin: 'http://localhost:8080', // 此处为你的前端地址，值可以是string | Array\u003cstring\u003e\n    credentials: true // 允许跨域携带cookie\n})) // 跨域\n```\n\n#### 2. 启动\n\n#### 安装依赖\n```shell\nyarn 或者 npm install\n```\n#### 启动\n```shell\nnpm start\n```\n\n## 项目启动说明（请先阅读）\n1. 项目依赖`redis`，启动项目请先去启动`redis`，否则报错\n2. 数据库结构在`/sql`文件夹下面\n3. `/src/common/alioss/config.js`文件是阿里云存储的配置选项,涉及私密信息这里我就不上传了，我把它的内容列出来，大家可以自己去阿里云文档查询对应的配置属性\n```js\nmodule.exports = {\n    region: \"\",\n    accessKeyId: \"\",\n    accessKeySecret: \"\",\n    bucket: \"\",\n    Action:\"\",\n    roleArn: \"\",\n    policy: JSON.stringify({\n        \"Version\": \"1\",\n        \"Statement\": [\n            {\n                \"Effect\": \"\",\n                \"Action\": \"\",\n                \"Resource\": [\n                    \n                ]\n            }\n        ]\n    }),\n    RoleSessionName:\"\"\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facmenlei%2Fnode-backend-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facmenlei%2Fnode-backend-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facmenlei%2Fnode-backend-template/lists"}