Skip to content

Commit c75ff7e

Browse files
author
公众号:Rong姐姐好可爱
authored
Merge pull request #108 from 142vip/feat/Readme.md
2 parents 06b4a5c + 26ae613 commit c75ff7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1956
-267
lines changed

README.md

Lines changed: 151 additions & 166 deletions
Large diffs are not rendered by default.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# 设置基础镜像
2+
FROM nginx:latest
3+
4+
# 将dist文件中的内容复制到 /usr/share/nginx/html/ 这个目录下面
5+
COPY dist/ /usr/share/nginx/html/
6+
# 用本地的 default.conf 配置来替换nginx镜像里的默认配置
7+
COPY default.conf /etc/nginx/conf.d/default.conf
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Express框架快速开始演示Demo
2+
3+
## 项目初始化
4+
5+
```bash
6+
## 初始化
7+
npm init
8+
```
9+
10+
## 下载依赖
11+
12+
```bash
13+
# 安装Express模块
14+
npm install express --save
15+
npm ci
16+
```
17+
18+
## 启动项目
19+
20+
查看项目路径:
21+
22+
```bash
23+
## 查看项目路径
24+
pwd
25+
```
26+
27+
![img.png](./images/pwd-info.png)
28+
29+
运行项目:
30+
31+
```bash
32+
## 运行服务
33+
node app.js
34+
```
35+
36+
或者使用`package.json`中的脚本,启动服务
37+
38+
```bash
39+
npm run dev
40+
```
41+
42+
服务运行,监听`3000`端口
43+
44+
## 调用服务
45+
46+
```bash
47+
## 调用API接口
48+
curl -i http://127.0.0.1:3000
49+
```
50+
51+
接口返回:`Hello World`
52+
53+
![](./images/hello-world.png)
54+
55+
## 参考
56+
57+
- <https://www.expressjs.com.cn/>
58+
- <https://www.npmjs.com/package/express>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const express = require('express')
2+
const app = express()
3+
const port = 3000
4+
5+
/**
6+
* 基础API服务,Get类型
7+
*/
8+
app.get('/', (req, res) => {
9+
res.send('Hello World!')
10+
})
11+
12+
app.listen(port, () => {
13+
console.log(`quick-start app listening on port ${port}`)
14+
})
37.6 KB
Loading
46.2 KB
Loading
9.18 KB
Loading

0 commit comments

Comments
 (0)