1.0.41 • Published 4 years ago

mares-welder v1.0.41

Weekly downloads
221
License
-
Repository
-
Last release
4 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

4 years ago

1.0.39

4 years ago

1.0.38

4 years ago

1.0.40

4 years ago

1.0.41

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

7 years ago