-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
360 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,11 @@ | |
**Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a | ||
high state of flux, you're at risk of it changing without notice. | ||
|
||
# 0.3.0 | ||
|
||
* **Breaking Change** | ||
* upgrade to `[email protected]` (@gcanti) | ||
|
||
# 0.2.0 | ||
|
||
* **Breaking Change** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
import * as express from 'express' | ||
import { Status, StatusOpen, ResponseEnded } from '../src' | ||
import { status, closeHeaders, send, MiddlewareTask } from '../src/MiddlewareTask' | ||
import { ExpressConn } from '../src/adapters/express' | ||
import { Status } from '../src' | ||
import { middleware } from '../src/MiddlewareTask' | ||
import { toExpressRequestHandler } from '../src/toExpressRequestHandler' | ||
|
||
const hello = status(Status.OK) | ||
.ichain(() => closeHeaders) | ||
.ichain(() => send('Hello hyper-ts on express!')) | ||
|
||
export const toRequestHandler = (task: MiddlewareTask<StatusOpen, ResponseEnded, void>): express.RequestHandler => ( | ||
req, | ||
res | ||
) => task.eval(new ExpressConn(req, res)).run() | ||
const hello = middleware | ||
.status(Status.OK) | ||
.ichain(() => middleware.closeHeaders) | ||
.ichain(() => middleware.send('Hello hyper-ts on express!')) | ||
|
||
express() | ||
.get('/', toRequestHandler(hello)) | ||
.get('/', toExpressRequestHandler(hello)) | ||
.listen(3000, () => console.log('Express listening on port 3000. Use: GET /')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import * as Koa from 'koa' | ||
import { Status, StatusOpen, ResponseEnded } from '..' | ||
import { status, closeHeaders, send, MiddlewareTask } from '../src/MiddlewareTask' | ||
import { KoaConn } from '../src/adapters/koa' | ||
import { Status } from '..' | ||
import { middleware } from '../src/MiddlewareTask' | ||
import { toKoaRequestHandler } from '../src/toKoaRequestHandler' | ||
|
||
const hello = status(Status.OK) | ||
.ichain(() => closeHeaders) | ||
.ichain(() => send('Hello hyper-ts on koa!')) | ||
const hello = middleware | ||
.status(Status.OK) | ||
.ichain(() => middleware.closeHeaders) | ||
.ichain(() => middleware.send('Hello hyper-ts on koa!')) | ||
|
||
const app = new Koa() | ||
|
||
const toRequestHandler = (task: MiddlewareTask<StatusOpen, ResponseEnded, void>): Koa.Middleware => ctx => | ||
task.eval(new KoaConn(ctx)).run() | ||
|
||
app.use(toRequestHandler(hello)).listen(3000, () => { | ||
app.use(toKoaRequestHandler(hello)).listen(3000, () => { | ||
console.log('Koa listening on port 3000. Use: GET /') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"strict": true, | ||
"noImplicitThis": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": false, | ||
"noFallthroughCasesInSwitch": true, | ||
"target": "es5", | ||
"moduleResolution": "node", | ||
"forceConsistentCasingInFileNames": true, | ||
"lib": [ | ||
"es6", | ||
"dom" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.