当前位置:网站首页>Management system itclub (Part 1)
Management system itclub (Part 1)
2022-06-27 22:08:00 【Big eye (◉ ɷ ◉) cute】
Management system -ITclub( On )
author : Xianda egg
The goal is : Complete the project
describe :ITclub It is a platform for programmers to share life dynamics
List of articles
1. Initialize project



First step : Let the project run first


Successful launch

2. Project directory structure
├── src # Source code
│ ├── router # route
│ ├── utils # Tool method
│ ├── conctroller # All controller methods
│ ├── service # Database operations
│ ├── utils # Global common method
│ ├── constants # Constant
│ ├── middleware # middleware
│ ├── main.js # Entrance file Load components Initialization etc.
├── postcss.config.js # postcss To configure
└── package.json # package.json
3. Project structures,
The application configuration information is written to the environment variable
① To write .env file

② adopt doenv Load the configured environment variables

③ Writing configuration files

Complete the project initialization (2022-05-23)
4. User registration interface
Writing process :
- Register user routes router To write ;
- The controller that handles the function controller To write ;
- Operating the database service To write ;
Be careful : Need to install koa Yes body Dependency resolution
// Catalog :./src/app/index.js
const Koa = require("koa")
const bodyParser = require("koa-bodyparser")
const userRouter = require('../router/user_router')
const app = new Koa()
app.use(bodyParser())
app.use(userRouter.routes())
app.use(userRouter.allowedMethods())
module.exports = app

Database connection operation (mysql2)
① install mysql2

② Connect to database

ps: The environment variables here need to be in
.envFill in the environment configuration file

Registered user verification
① Write user information to the database
# Create a user table
CREATE TABLE IF NOT EXISTS `user`(
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(30) NOT NULL UNIQUE,
password VARCHAR(50) NOT NULL,
createAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updateAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

- Insert the success

② Verify user , Create middleware verifyUser(./src/middleware/user_middleware)





③ Verify whether the user has registered



Password encrypted storage
Block the password registered by the user and encrypt it , And then stored in the database , Prevent database leaks , Here the MD5 encryption
① establish handlePassword function

② stay utils Create under directory password_handle.js

Complete the user registration interface (2022-05-24)
5. User login interface
Writing process
- to grant authorization router Compiling


- Dealing with functions contrler To write

Verification middleware (verifyLogin)
- Whether the account and password are empty

- Whether the user name exists

- Verify that the passwords are consistent

- To complete the verification
Supplementary treatment (index.js) Route introduction encapsulation in


Successful login returns credentials
Be careful : Add here cookie and token Knowledge about http://t.csdn.cn/u4tO1
introduce keys( Reference resources http://t.csdn.cn/u4tO1 )–> Write the public and private keys to the configuration file (src/app/config.js)

Dispatch token and verification token

① Write verification test interface


√ Complete the user interface design (20222-5-27)
边栏推荐
- ∫(0→1) ln(1+x) / (x ² + 1) dx
- .NET学习笔记(五)----Lambda、Linq、匿名类(var)、扩展方法
- 北京邮电大学|用于成本和延迟敏感的虚拟网络功能放置和路由的多智能体深度强化学习
- Have time to look at ognl expressions
- 使用sqlite3语句后出现省略号 ... 的解决方法
- Codeforces Round #717 (Div. 2)
- PCIe knowledge point -008: structure of PCIe switch
- 【mysql实战】查询语句实战演示
- C language programming detailed version (learning note 1) I can't understand it after reading, and I can't help it.
- Go from introduction to practice -- shared memory concurrency mechanism (notes)
猜你喜欢

MYSQL和MongoDB的分析

01 golang environment construction

STM32CubeIDE1.9.0\STM32CubeMX 6.5 F429IGT6加LAN8720A,配置ETH+LWIP

win11桌面出現“了解此圖片”如何删除

Codeforces Round #717 (Div. 2)
![[leetcode] dynamic programming solution split integer i[silver fox]](/img/18/8dc8159037ec1262444db8899cde0c.png)
[leetcode] dynamic programming solution split integer i[silver fox]

Système de gestion - itclub (II)

畅游动态规划之区间DP

CUDA error:out of memory caused by insufficient video memory of 6G graphics card

【Redis】零基础十分钟学会Redis
随机推荐
[sword offer ii] sword finger offer II 029 Sorted circular linked list
C语言程序设计详细版 (学习笔记1) 看完不懂,我也没办法。
Test automatique de Test logiciel - test d'interface de l'introduction à la maîtrise, apprendre un peu chaque jour
畅游动态规划之区间DP
Gbase 8A OLAP analysis function cume_ Example of dist
Professor of Tsinghua University: software testing has gone into a misunderstanding - "code is necessary"
[leetcode] dynamic programming solution split integer i[silver fox]
Read write separation master-slave replication of MySQL
GBase 8a V8版本节点替换期间通过并发数控制资源使用减少对系统影响的方法
Codeforces Round #719 (Div. 3)
Have time to look at ognl expressions
正则表达式
YOLOv6:又快又准的目标检测框架开源啦
Gbase 8A OLAP analysis function cume_ Example of dist
洛谷P5706 再分肥宅水
[leetcode] dynamic programming solution partition array ii[arctic fox]
Quick excel export according to customized excel Title Template
. Net learning notes (V) -- lambda, LINQ, anonymous class (VaR), extension method
Acwing weekly contest 57- digital operation - (thinking + decomposition of prime factor)
QT large file generation MD5 check code
