当前位置:网站首页>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)
边栏推荐
- Interval DP of Changyou dynamic programming
- 大厂常用软件测试面试题三(附答案)
- 软件缺陷管理——测试人员必会
- Summary of Web testing and app testing by bat testing experts
- 01 golang environment construction
- 分享|智慧环保-生态文明信息化解决方案(附PDF)
- [LeetCode]508. The most frequent subtree elements and
- qt base64加解密
- 百万年薪独家专访,开发人员不修复bug怎么办?
- Stm32cubeide1.9.0\stm32cubemx 6.5 f429igt6 plus lan8720a, configure eth+lwip
猜你喜欢

Secret script of test case design without leakage -- module test
![[LeetCode]动态规划解拆分整数I[Silver Fox]](/img/18/8dc8159037ec1262444db8899cde0c.png)
[LeetCode]动态规划解拆分整数I[Silver Fox]

Experience sharing of meituan 20K Software Test Engineers

PCIe knowledge point -008: structure of PCIe switch
![[leetcode] dynamic programming solution split integer i[silver fox]](/img/18/8dc8159037ec1262444db8899cde0c.png)
[leetcode] dynamic programming solution split integer i[silver fox]

Figure countdownlatch and cyclicbarrier based on AQS queue

百万年薪独家专访,开发人员不修复bug怎么办?

Go from introduction to practice - error mechanism (note)
![[MySQL] database function clearance Tutorial Part 2 (window function topic)](/img/03/2b37e63d0d482d5020b7421ac974cb.jpg)
[MySQL] database function clearance Tutorial Part 2 (window function topic)

GBase 8a的create database 会被查询耗时很长怀疑卡住的现象分析
随机推荐
软件缺陷管理——测试人员必会
GBase 8a的create database 会被查询耗时很长怀疑卡住的现象分析
Go from introduction to practice - error mechanism (note)
单元测试界的高富帅,Pytest框架,手把手教学,以后测试报告就这么做~
[LeetCode]508. 出现次数最多的子树元素和
How many ways does selenium upload files? I don't believe you have me all!
Educational Codeforces Round 108 (Rated for Div. 2)
GBase 8a OLAP分析函数 cume_dist的使用样例
"Apprendre cette image" apparaît sur le Bureau win11 comment supprimer
读写分离-Mysql的主从复制
Gbase 8A OLAP analysis function cume_ Example of dist
The create database of gbase 8A takes a long time to query and is suspected to be stuck
[LeetCode]508. The most frequent subtree elements and
gomock mockgen : unknown embedded interface
Have time to look at ognl expressions
Open source technology exchange - Introduction to Chengying, a one-stop fully automated operation and maintenance manager
【Redis】零基础十分钟学会Redis
Système de gestion - itclub (II)
记一次List对象遍历及float类型判断大小
This set of steps for performance testing using JMeter includes two salary increases and one promotion
