- vue + vue-router + vuex + axios + less
cd segment npm i npm run dev
- express + mysql
cd server npm i npm start - mysql config
mysql: {'host': 'localhost','user': 'root','password': '','database': 'segment2','port': '3306'}
- API error code
- 200 success
- 400 error
- 401 连接错误
- 402 登录过期
// 用户表 CREATETABLE `user` ( `uid`int(11) NOT NULL AUTO_INCREMENT COMMENT '用户id', `mobile`char(15) DEFAULT NULL, `email`varchar(60) DEFAULT NULL, `pwd`varchar(60) NOT NULL, `username`varchar(120) NOT NULL, `update_time`timestampNOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', `create_time`timestampNOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', PRIMARY KEY (`uid`), UNIQUE KEY `username_unique` (`username`), UNIQUE KEY `email_unique` (`email`), UNIQUE KEY `mobile_unique` (`mobile`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; // 问题表 createtablequestions( q_id smallint unsigned primary key auto_increment, q_title varchar(220) not null, q_tag varchar(50) not null, q_content longtext not null, votes intnot null default 0, views int unsigned not null default 0, answer int unsigned not null default 0, last_res_id int unsigned comment '最近回复的用户id', create_time timestamp default current_timestamp, user_id intnot null, last_res_time timestamp )engine=innodb default charset=utf8;