Nodejs-back-template is a minimalist framework that can quickly build nodejs interface services. It is compressed and packaged by webpack, encapsulates websocket, httpserve, file operation, mysql access and other methods, and has a complete interface routing system.
npm install
- npm run watch // can monitor file changes in real time and dynamically update dist/main.js environment to development
- npm run serve // dist/main.js
- npm run build // package to dist/main.js environment for production
- npm run lint // detects and fixes eslint problems
- Fork the repository
- Create Feat_xxx branch
- Commit your code
- Create Pull Request
- server encapsulation
- ws encapsulation
- Separate entry main.js
- The ws interface passed layer by layer can operate the ws object when invoked, and the socketList in ws is the socket object of all the users that have established connections
- Unified route management
- Uniform request parameter reading
- token blocking
MIT License
Copyright (c) 2023
Software architecture description
|-- nodejs-template-back
|-- src
| |-- main.js // main function
| |-- serve.js // service encapsulation
| |-- common // constants and public methods
| | |-- BaseResponse.js // request returns encapsulation
| | |-- CONSTANT
| | |-- index.js // constants main entry, automatic import all modules
| | |-- modules
| | |-- RESPONSE.js // request code constants
| | |-- WHITEURL.js // interface white list
| |-- config
| | |-- config.development.js // development environment set up
| | |-- config.js // public environment Settings
| | |-- config.production.js // production environment Settings
| | |-- index.js // main entry according to the environment into the config
| |-- controller
| | |-- user.js
| |-- dao
| | |-- db.js
| | |-- modules
| | |-- user.js
| |-- service
| | |-- user.js
| |-- utils
| | |-- auth.js // Permission operation
| | |-- file.js // file operations
| | |-- lock.js
| | |-- router.js // routing class
| |-- webSocket
| | |-- index.js
| | |-- WsResponse.js // ws return value total entry encapsulation
| |-- |-- distribute // event distribution
| | |-- index.js // event distribution main entry, automatically import all modules under the modules
| | |-- modules
| | |-- user.js
|-- .eslintrc.js
|-- webpack.config.js // webpack configuration