代码拉取完成,页面将自动刷新
require('babel-register')
require("babel-polyfill");
var path = require("path");
var express = require("express");
var jwt = require('express-jwt');
var bodyParser = require('body-parser');
var tokenManager = require('./config/token_manager');
var secret = require('./config/secret');
//Routes
var routes = {};
routes.users = require('./route/user.js');
var app = express();
var serverPort = process.env.PORT || 3000;
app.listen(serverPort, "localhost", function (err) { // 192.168.7.148
if (err) {
console.log(err);
return;
}
console.log("Listening at http://localhost:" + serverPort);
});
app.use(function(req, res, next) {
// res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
// res.header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE');
next();
});
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static(path.join(__dirname, 'btb')))
// index.html//默认跳转主页
app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
});
app.get('/node/user/info', tokenManager.verifyToken, routes.users.userInfo);
// app.post('/superaplipay/pay', jwt({secret: secret.secretToken}), tokenManager.verifyToken, routes.superAplipay.pay);
process.on('uncaughtException', function(err){
console.log(err);
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。