enoyao
enoyao
# 连接池 建议使用连接池来操作数据库,按照上面的连接方法会连接完又中断一次,这样频繁操作会导致程序有可能卡死不响应,只有重启nodejs服务才能解决,所以建议使用连接池来避免这个问题 ```js const mysql = require("mysql"); const pool = mysql.createPool({ host: 'localhost', user: 'wscats', password: '123', database: 'wscats', //port: port }); const query = function(sql, options, callback) {...
## 批量下载图片 DEMO1 ```js var http = require("http"); var https = require("https"); var cheerio = require("cheerio"); var fs = require('fs'); function download(url, callback) { http.get(url, function(res) { var data =...
## 批量下载图片 DEMO2 ```js var http = require('http'); var fs = require('fs'); function Mzitu(options) { this.id = 1; this.initialize.call(this, options); return this; } Mzitu.prototype = { constructor: Mzitu, initialize: function...
# 酷狗批量下载音乐 参考1 ```js var request = require('request'); var cheerio = require('cheerio'); var fs = require('fs'); request('http://www.kugou.com/yy/singer/home/3060.html', function(error, response, body) { //console.log(body) var $ = cheerio.load(body); var arr = $('.song_hid');...
# API > http://tingapi.ting.baidu.com/v1/restserver/ting ## 列表: > http://tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.billboard.billList&type=1&size=10&offset=0 参数: - type = 1-新歌榜,2-热歌榜,11-摇滚榜,12-爵士,16-流行,21-欧美金曲榜,22-经典老歌榜,23-情歌对唱榜,24-影视金曲榜,25-网络歌曲榜 - size = 10 //返回条目数量 - offset = 0 //获取偏移 ## 搜索 > http://tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.search.catalogSug&query=海阔天空 参数: - query...
https://documenter.getpostman.com/view/5326062/RzfgpVeV#67c3965b-ce04-4077-aa2d-e22cd2f343c4
# 简单安装 最简单的引入方案,引入核心`egret.js`在页面中进行开发 ```HTML Document * { margin: 0; padding: 0; } ``` 逻辑文件`main.js` ```js class Main extends egret.DisplayObjectContainer { constructor() { super(); this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this); } onAddToStage(event) { let...
**require.js加载js文件的好处** 1. 可以防止JS加载时候阻塞页面渲染(JS运行时候DOM停止渲染的情况) 2. 使用require.js调用的方式加载JS,不用在像以前那样多个``标签引入JS文件 所有代码的目录结构如图  [代码存放的Github地址](https://github.com/Wscats/requirejs-demo) ## 传统的引入 **start.html** ```html wsscat ``` 传统方法引入可以看到会先弹出alert,内容被阻塞没有渲染 **a.js** ```js function cat(){ alert("hello"); } cat(); ``` ## require.js的引入 **start.html** ```html require(["js/a"]); wsscat ```...
@session-z I will debug and check the reason, thx.
## Git下载安装 克隆项目地址并下载(需要已安装[Git](https://git-scm.com/downloads)) ``` git clone https://github.com/Wscats/news.git ``` 启动服务(http://localhost:12345/news/index.html) ``` npm run dev ``` ## 开发 通过`npm`安装本地服务第三方依赖模块(需要已安装[Node.js](https://nodejs.org/)),当然也可以先不安装依赖暂时省略这步,运行`node http`直接查看项目效果 ``` npm install ``` 然后执行gulp构建项目文件和打开服务器等 ``` npm run test ``` ## 目录结构...