1.0.41 • Published 2 years ago

mares-welder v1.0.41

Weekly downloads
221
License
-
Repository
-
Last release
2 years ago

mares-welder

Mares framework의 중심이 되는 모듈로 express를 wrapping 합니다. 추후 해당 모듈은 리팩토링이 필요합니다. mares-welder를 이용하면 express는 바로 사용하지 않아도 됩니다.

Installation

npm install --save mares-welder

Example

/**
 * start application
 * @param {string} rootDir - project root dir
 * @returns {Promise<Express>}
 */
async startApp = (rootDir) => {
	
	// mares module을 불러옵니다.
    const accountContext = reuiqre('../module-account')
    const senderContext = reuiqre('../module-sender')
    const MaresWelder = require('mares-welder')
    
    // 프로젝트 최상단 경로와 함께 mares instace를 생성합니다.
    const mares = new MaresWelder('root path')
    
    // express error handler를 등록해줍니다.
    mares.bindExpressErrorHandler((error, req, res, next) => {
        //todo    	
    })
    
    // 모듈을 추가합니다.
    mares.attach(accountContext, 1)
    mares.attach(senderContext, 1)
    mares.use((req, res, next) => {
    	// todo middleware
    	next()
    })
    
    // 모든 routing 되는 api의 앞에 apis url을 추가합니다.
    mares.setApiPrefix('apis')
    
    // 몽구스에 연결합니다.
    await mares.connectMongoose('mongoose url')
    
    // listen을 실행하여 express를 구동시킵니다.
    await mares.listen(settings.config['app'].port)

    // mongoose를 종료시킵니다.    
    await mares.getMongoose().disconnect()
    
    // express 서버를 종료시킵니다.
    await mares.disconnectApp()
}
1.0.37

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago

1.0.40

2 years ago

1.0.41

2 years ago

1.0.36

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.1

6 years ago