@bigtest/effection-express
Advanced tools
Comparing version 0.1.1-089e697 to 0.1.1-0ca7157
/// <reference types="node" /> | ||
import { Operation } from 'effection'; | ||
import { Express as ActualExpress, RequestHandler } from 'express'; | ||
import { Server } from 'http'; | ||
export declare class Express { | ||
private inner; | ||
private server?; | ||
constructor(inner: ActualExpress); | ||
use(...handlers: RequestHandler[]): void; | ||
private server; | ||
constructor(inner: any); | ||
use(middleware: any): void; | ||
listen(port: number): Operation<Server>; | ||
@@ -11,0 +10,0 @@ join(): Operation<void>; |
@@ -5,2 +5,3 @@ "use strict"; | ||
const actualExpress = require("express"); | ||
const events_1 = require("@effection/events"); | ||
const effection_2 = require("@bigtest/effection"); | ||
@@ -11,4 +12,4 @@ class Express { | ||
} | ||
use(...handlers) { | ||
this.inner.use(...handlers); | ||
use(middleware) { | ||
this.inner.use(middleware); | ||
} | ||
@@ -18,7 +19,7 @@ *listen(port) { | ||
let res = yield effection_1.resource(server, function* () { | ||
yield effection_2.monitorErrors(server); | ||
yield events_1.throwOnErrorEvent(server); | ||
yield effection_2.ensure(() => server.close()); | ||
yield; | ||
}); | ||
yield effection_2.once(server, "listening"); | ||
yield events_1.once(server, "listening"); | ||
return res; | ||
@@ -28,3 +29,3 @@ } | ||
if (this.server) { | ||
yield effection_2.once(this.server, 'close'); | ||
yield events_1.once(this.server, 'close'); | ||
} | ||
@@ -31,0 +32,0 @@ } |
{ | ||
"name": "@bigtest/effection-express", | ||
"version": "0.1.1-089e697", | ||
"version": "0.1.1-0ca7157", | ||
"description": "Makes it easy to use Express from Effection", | ||
@@ -21,5 +21,5 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@frontside/tsconfig": "*", | ||
"@types/mocha": "^7.0.1", | ||
"@types/node": "^12.7.11", | ||
"@types/node": "^13.13.4", | ||
"effection": "^0.6.2", | ||
"expect": "^24.9.0", | ||
@@ -29,5 +29,8 @@ "mocha": "^6.2.2", | ||
}, | ||
"peerDependencies": { | ||
"effection": "^0.6.2" | ||
}, | ||
"dependencies": { | ||
"@types/node": "^12.7.11", | ||
"effection": "^0.6.0", | ||
"@effection/events": "^0.6.1", | ||
"@types/node": "^13.13.4", | ||
"express": "^4.17.1" | ||
@@ -34,0 +37,0 @@ }, |
Sorry, the diff of this file is not supported yet
3468
4
+ Added@effection/events@^0.6.1
+ Added@effection/events@0.6.1(transitive)
+ Added@types/node@13.13.52(transitive)
- Removedeffection@^0.6.0
- Removed@types/node@12.20.55(transitive)
Updated@types/node@^13.13.4