I. Project introduction
- 1,
java
theMVC
The classic development model (innestjs
Development can also use basedangular
Modular development mode, depending on personal preference), to build the project structure, but also meet the needs of back-end enterprise development. - 2. The project is based on
mysql
database-developed - 3, use,
jwt
For login authentication (granularity only to menu permission)
Ii. Use items
-
1. This project only implements the rBAC permission system, and other functions need to be expanded based on this basis
-
2. Create a database locally
-
3, in the root directory of the project. Env file change to your own database basic configuration (address, username, password, database)
-
4. Run commands to map entity classes to the database and generate data tables
npm run generate npm run db Copy the code
-
5. Start the project
npm run start:dev Copy the code
-
6. Default initialization of menu data and user data (account :admin, password :123456)
-
7, If you want to initialize other data, you can write the data you want to initialize in SRC /services/init-db
Two, the main functions
-
Implement user login and JWT authentication
-
If you want to transform an existing project into a new project (based on existing tables), try using commands
#Database files are mapped to generate typeORM entity classes npm run db1 Copy the code
-
If you are a new project, you can use data migration to manually map your entity classes to the database if needed
npm run generate npm run db Copy the code
-
Access control based on RBAC
The project uses the account based way to replace the user,(for a user may have several accounts in the case of extension), so after getting the project, the general process is
- Create a user first
- Associate an account with a user when creating an account
-
When creating an account, you can select a role for the account
-
When creating a role, the permission list is displayed in a tree structure. You can select the corresponding permission
-
Dictionary management is primarily used for configuration drop-down boxes in projects
-
Several modules are uniformly encapsulated in module
code
It is the captcha modulefile
File moduleupload-img
Picture upload, can be uploaded to local and Ali cloudoss
onupload-excel
The importexcel
file
redis-utils
Encapsulate several aboutredis
The moduleyunpian-sms
It was Yunge.com that sent the text messages
-
Server.config. js is a PM2 configuration file. After the project is developed, you can run a command to deploy it in one click
npm run build npm run pm2:prod Copy the code
-
The log system is not developed. Use PM2 to view logs
pm2 log Copy the code