摘要: var sleep = function (time) { return new Promise(function (resolve, reject) { setTimeout(function () { //此处执行异步操作 resolve('ok'); }, time); }); }; var sta... 阅读全文
posted @ 2017-05-12 16:26 webbky 阅读(120) 评论(0) 推荐(0) 编辑
摘要: var mysql=require("mysql"); var pool = mysql.createPool({ host: 'localhost', user: 'root', password: '123456', database: 'test1', port: 3306 }); var query = function(sql,callback)... 阅读全文
posted @ 2017-05-12 14:51 webbky 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 接收前台参数 1、对于path中的变量,均可以使用req.params.xxxxx方法 2、对于get请求的?xxxx=,使用req.query.xxxxx方法 3、对于post请求中的变量,使用req.body.xxxxx方法 注:在使用req.param()的时候 会被提示 2:api文件 ex 阅读全文
posted @ 2017-05-12 13:35 webbky 阅读(114) 评论(0) 推荐(0) 编辑
摘要: z在请求本地的时候 如果ajax的URL 前面没有http的话 就会报错 阅读全文
posted @ 2017-05-12 11:26 webbky 阅读(322) 评论(0) 推荐(0) 编辑