当前位置:网站首页>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)
边栏推荐
- [LeetCode]161. Edit distance of 1
- Analysis of stone merging
- 年薪50W+的测试大鸟都在用这个:Jmeter 脚本开发之——扩展函数
- How to do function test well? Are you sure you don't want to know?
- "Apprendre cette image" apparaît sur le Bureau win11 comment supprimer
- Interview question 3 of software test commonly used by large factories (with answers)
- Set code exercise
- 【Redis】零基础十分钟学会Redis
- Test birds with an annual salary of 50w+ are using this: JMeter script development -- extension function
- MONTHS_BETWEEN函数使用
猜你喜欢

Set code exercise

Yarn中RMApp、RMAppAttempt、RMContainer和RMNode状态机及其状态转移

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 会被查询耗时很长怀疑卡住的现象分析

Codeforces Round #723 (Div. 2)

6G显卡显存不足出现CUDA Error:out of memory解决办法

PCIe knowledge point -008: structure of PCIe switch

【MySQL】数据库函数通关教程下篇(窗口函数专题)

BAT测试专家对web测试和APP测试的总结
随机推荐
Secret script of test case design without leakage -- module test
I think I should start writing my own blog.
二维数组中修改代价最小问题【转换题意+最短路径】(Dijkstra+01BFS)
Contest 2050 and Codeforces Round #718 (Div. 1 + Div. 2)
我想我要开始写我自己的博客了。
熊市慢慢,Bit.Store提供稳定Staking产品助你穿越牛熊
Sharing | intelligent environmental protection - ecological civilization informatization solution (PDF attached)
It smells good. Since I used Charles, Fiddler has been completely uninstalled by me
[LeetCode]161. 相隔为 1 的编辑距离
[LeetCode]100. Same tree
正则表达式
The create database of gbase 8A takes a long time to query and is suspected to be stuck
Remote invocation of microservices
CUDA error:out of memory caused by insufficient video memory of 6G graphics card
Stm32f107+lan8720a use stm32subemx to configure network connection +tcp master-slave +udp app
VMware virtual machine PE startup
登录凭证(cookie+session和Token令牌)
"Apprendre cette image" apparaît sur le Bureau win11 comment supprimer
Oracle migration MySQL unique index case insensitive don't be afraid
Gao fushuai in the unit testing industry, pytest framework, hands-on teaching, will do this in the future test reports~
