@naxmefy/koa-starter
1.0.1 • Public • Published
node-koa-starter
![npm version](https://camo.githubusercontent.com/c3cd1cc13c7bdfd8689c12aa05b855ee679c19c5aaefdea8f467248b2b090aca/68747470733a2f2f62616467652e667572792e696f2f6a732f2534306e61786d6566792532466b6f612d737461727465722e737667)
![Coverage Status](https://camo.githubusercontent.com/ebcbcd2b32aec2cf707da66edcb91d7fca990b6835034dd6ae55089c5de708b6/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6e61786d6566792f6e6f64652d6b6f612d737461727465722f62616467652e7376673f6272616e63683d6d6173746572)
Installation
$ npm install --save @naxmefy/koa-starter
Usage
import Koa from 'koa'
import koaStarter from '@naxmefy/koa-starter'
const app = koaStarter(Koa, {})
if (!module.parent) {
app.start()
}
Usage (Testing - mocha + co-mocha + supertest)
import supertest from 'supertest'
import app from '../src'
before(function () {
this.app = koaStarter(Koa, {
onBootstrap () {
this.calledOnBooststrap = true
}
})
this.request = supertest(this.app.start({
port: null,
ip: null
}))
})
describe('app', function () {
it('should be bootstrapped', function () {
this.app.isBootstrapped.should.be.ok()
this.app.calledOnBooststrap.should.be.ok()
})
it('should response 404', function * () {
const response = yield this.request.get('/')
response.status.should.be.eql(404)
})
})
/@naxmefy/koa-starter/
//
Package Sidebar
Install
npm i @naxmefy/koa-starter
Weekly Downloads