본문 바로가기
NodeJs

class

by ByteBridge 2020. 1. 10.
반응형
class cacheManage{
	constructor(){
		this.config = []
	}
	addConfig(obj={}){
		this.config.push(obj)
	}
	getConfig() {
		return this.config
	}
}

const CacheManage = new cacheManage()
CacheManage.addConfig({
	port: 8080
})
const config = CacheManage.getConfig()
module.exports = cacheManage
반응형

'NodeJs' 카테고리의 다른 글

destructing  (0) 2020.01.10
class 상속  (0) 2020.01.10
arrow function  (0) 2020.01.10
error handling  (0) 2020.01.10
event emitter  (0) 2020.01.10