-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpressApp.js
More file actions
23 lines (23 loc) · 851 Bytes
/
Copy pathexpressApp.js
File metadata and controls
23 lines (23 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const express = require('express')
const app = express();
const path = require('path')
const fs = require('fs')
app.set('views', path.join(__dirname, 'views'))
// app.set('view engine', 'art')
// app.engine('art', require('express-art-template'))
//开放静态资源文件
const public = path.join(__dirname, 'public') //路径拼接
app.use(express.static(public))
// const home = require('./route/home')
// const admin = require('./route/admin')
// app.use('/home', home)
// app.use('/admin', admin)
app.get('/login', (req, res, next) => {
const content = fs.readFileSync('./public/admin/login.html').toString()
res.send(content)
// res.send("<h1>hello world</h1>")
// res.render('./public/admin/login.html')//not available
})
// app.use(router.routes())
app.listen(800);
console.log('服务器启动成功,http://localhost:800')