Day1:
a. 項(xiàng)目概述
文章來源:http://www.zghlxwxcb.cn/news/detail-552222.html
b. 開發(fā)環(huán)境搭建
(1). 前端環(huán)境搭建
- 前端工程基于 nginx 運(yùn)行
- 啟動(dòng)nginx:雙擊 nginx.exe 即可啟動(dòng) nginx 服務(wù),訪問端口號(hào)為 80
(2). 后端環(huán)境搭建
- 后端工程基于 maven 進(jìn)行項(xiàng)目構(gòu)建,并且進(jìn)行分模塊開發(fā)
(3). 前后端聯(lián)調(diào)
文章來源地址http://www.zghlxwxcb.cn/news/detail-552222.html
c. 完善登錄功能
-
- 修改數(shù)據(jù)庫中明文密碼,改為MD5加密后的密文
-
- 修改Java代碼,前端提交的密碼進(jìn)行MD5加密后再跟數(shù)據(jù)庫中密碼比對(duì)//進(jìn)行md5加密,然后再進(jìn)行比對(duì)
//進(jìn)行md5加密,然后再進(jìn)行比對(duì)
// TODO 后期需要進(jìn)行md5加密,然后再進(jìn)行比對(duì)
password = DigestUtils.md5DigestAsHex(password.getBytes());
if (!password.equals(employee.getPassword())) {
//密碼錯(cuò)誤
throw new PasswordErrorException(MessageConstant.PASSWORD_ERROR);
}
d. Swagger
- 1.導(dǎo)入 knife4j 的maven坐標(biāo)
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.2</version>
</dependency>
- 2.在配置類中加入 knife4j 相關(guān)配置
/**
* 通過knife4j生成接口文檔
* @return
*/
@Bean
public Docket docket() {
log.info("準(zhǔn)備生成接口文檔");
ApiInfo apiInfo = new ApiInfoBuilder()
.title("蒼穹外賣項(xiàng)目接口文檔")
.version("2.0")
.description("蒼穹外賣項(xiàng)目接口文檔")
.build();
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo)
.select()
.apis(RequestHandlerSelectors.basePackage("com.sky.controller"))
.paths(PathSelectors.any())
.build();
return docket;
}
- 3.設(shè)置靜態(tài)資源映射,否則接口文檔頁面無法訪問
/**
* 設(shè)置靜態(tài)資源映射
* @param registry
*/
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
到了這里,關(guān)于itheima蒼穹外賣項(xiàng)目學(xué)習(xí)筆記--Day1:項(xiàng)目介紹與開發(fā)環(huán)境搭建的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!