get_server_list.js 472 B

12345678910111213141516171819
  1. //获取玩家区服数据
  2. let mysqlcn = require('./mysqlcn.js');
  3. let query = mysqlcn.query;
  4. let express = require('express');
  5. let router = express.Router();
  6. router.get('/get_server_list', function(req, res) {
  7. let sql = "SELECT * FROM list";
  8. query(sql,function(qerr,vals,fields_){
  9. if (qerr==null){
  10. res.send(JSON.stringify(vals));
  11. }
  12. else{
  13. res.send(JSON.stringify({}));
  14. }
  15. });
  16. });
  17. module.exports = router;