Skip to content

Commit d851906

Browse files
committed
render domain/uptoken_url
1 parent 5d50c46 commit d851906

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

demo/server.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ app.configure(function() {
77
app.use(express.static(__dirname + '/'));
88
});
99

10+
app.set('views', __dirname + '/views');
11+
app.engine('html', require('ejs').renderFile);
12+
13+
1014
app.use(function(req, res, next) {
1115
req.headers['if-none-match'] = 'no-match-for-this';
1216
next();
@@ -20,13 +24,15 @@ app.get('/token', function(req, res, next) {
2024
if (token) {
2125
res.json({
2226
uptoken: token
23-
})
27+
});
2428
}
2529
});
2630

2731
app.get('/', function(req, res) {
28-
res.setHeader('Pragma', 'no-cache');
29-
res.sendfile(__dirname + '/index.html')
32+
res.render('index.html', {
33+
domain: config.Domain,
34+
uptoken_url: config.Uptoken_Url
35+
});
3036
});
3137

3238
qiniu.conf.ACCESS_KEY = config.ACCESS_KEY;

0 commit comments

Comments
 (0)