.
├── logs # 存放日志
│ ├── 1.log
│ └── 2.log
├── package.json # 依赖包
├── scripts # 脚本集合
│ └── do_some_thing.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node { | |
constructor(prev, value, next) { | |
this.prev = prev; | |
this.next = next; | |
this.value = value; | |
} | |
} | |
const CURRENT_INDEX = Symbol('current index in cycle'); | |
const ROUND_INDEX = Symbol('how many round in cycle'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pool | |
type CreatorFunc func() (interface{}, error) | |
type DestroyerFunc func(resource interface{}) (interface{}, error) | |
type Pool struct { | |
config Config | |
options Options | |
pool []interface{} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pool | |
import "time" | |
type Event struct { | |
Time time.Time | |
Name string | |
Data interface{} | |
Id string | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generate a New status | |
* @param code | |
* @param message | |
* @constructor | |
*/ | |
function Status(code, message) { | |
this.code = code; | |
this.message = message; | |
} |
代码全部来源于官方教程
新建目录,把所有文件放在同一目录下
在该目录下执行命令
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Koa = require('koa'); | |
const Router = require('koa-router'); | |
const methods = require('methods'); | |
const router = new Router(); | |
const KOA = Symbol('koa instance'); | |
class Server { | |
constructor() { | |
this[KOA] = new Koa(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hashCode(any) { | |
let hash = 0; | |
if ( | |
any === null || | |
any === void 0 || | |
any === '' || | |
any === 0 || | |
any === false | |
) { | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Auto detect text files and perform LF normalization | |
* text=auto | |
# JS and TS files must always use LF for tools to work | |
*.js eol=lf | |
bin/* eol=lf |