-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
36 lines (24 loc) · 720 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* app.js:入口文件
controller:控制台
views:资源文件(jade、ejs)
modles:处理业务逻辑
uploads:上传目录的文件夹
public:公共资源,img、css
node_modules:模块依赖文件夹
*/
var express = require("express")
var app = express()
var router = require("./controller/route.js")
app.set("view engine","ejs")
//配置静态资源
app.use(express.static("./public"))
app.use(express.static("./uploads"))
app.get("/",router.showIndex)
app.get("/:photoName",router.showPhoto)//显示相册,在url上面显示文件夹名字
app.get("/up",router.showUp)//上传按钮
app.post("/up",router.doPost)
app.use(function(req,res){
res.render("err")
})
app.listen(3000)