-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathindex.js
38 lines (34 loc) · 1.01 KB
/
index.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
37
38
var path = require('path')
var express = require('express')
var ejs = require('ejs')
var port = "8188"
var app = express()
var service = require('./service.js')
// setCrossDomain (req,
// res, next) {
// res.append('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, If-Modified-Since')
// res.append('Access-Control-Allow-Credentials', 'true')
// res.append('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE')
// res.append('X-Powered-By', '3.2.1')
// res.append('Content-Type', 'application/json;charset=utf-8')
// next()
// }
// app.use(setCrossDomain)
module.exports = app.listen(port, function (err) {
if (err) {
console.log(err)
return
}
// 获取token
app.get('/alioss/getOssToken', function(req, res) {
res.append('Access-Control-Allow-Origin', '*')
const result = service.getOssToken(req, res)
if (result) {
res.json({
code: 100,
data: result
})
}
})
console.log('Listening at http://localhost:' + port + '\n')
})