Skip to content

Commit

Permalink
Version 6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Avaq committed Apr 27, 2021
1 parent ccde299 commit 5205beb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ be used.

You can load the EcmaScript module from various content delivery networks:

- [Skypack](https://cdn.skypack.dev/fluture-express@5.0.0)
- [JSPM](https://jspm.dev/fluture-express@5.0.0)
- [jsDelivr](https://cdn.jsdelivr.net/npm/fluture-express@5.0.0/+esm)
- [Skypack](https://cdn.skypack.dev/fluture-express@6.0.0)
- [JSPM](https://jspm.dev/fluture-express@6.0.0)
- [jsDelivr](https://cdn.jsdelivr.net/npm/fluture-express@6.0.0/+esm)

### Usage Example

Expand Down Expand Up @@ -77,7 +77,7 @@ Fluture-Express mutates the response object for you, based on a
specification of what the response should be. This specification is
captured by the Response sum-type.

#### <a name="Response" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L156">`Response :: Type`</a>
#### <a name="Response" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L164">`Response :: Type`</a>

The Response sum type encoded with [daggy][]. You probably don't need to
use this directly.
Expand All @@ -87,7 +87,7 @@ data Response a b = Respond (Array Head) (Body a)
| Next b
```

#### <a name="Head" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L172">`Head :: Type`</a>
#### <a name="Head" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L180">`Head :: Type`</a>

The Head sum type encoded with [daggy][]. You probably don't need to
use this directly.
Expand All @@ -103,19 +103,20 @@ data Head = Status Number
| Header String String
```

#### <a name="Body" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L200">`Body :: Type`</a>
#### <a name="Body" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L208">`Body :: Type`</a>

The Body sum type encoded with [daggy][]. You probably don't need to
use this directly.

```hs
data Body a = None
| Send Any
| Json JsonValue
| Stream (Future a Readable)
| Render String Object
```

#### <a name="Stream -> Future a Readable -> Response a b" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L220">`Stream -⁠> Future a Readable -⁠> Response a b`</a>
#### <a name="Stream -> Future a Readable -> Response a b" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L238">`Stream -⁠> Future a Readable -⁠> Response a b`</a>

Creates a streamed response given a mime type and a Future that produces
a Readable Stream when consumed. The Future is expected to produce a new
Expand All @@ -126,82 +127,81 @@ Uses a Content-Type of `application/octet-stream` unless overridden by
[`withType`](#withType), [`withHeader`](#withHeader),
or [`withoutHeader`](#withoutHeader).

#### <a name="Text" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L235">`Text :: String -⁠> Response a b`</a>
#### <a name="Text" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L253">`Text :: String -⁠> Response a b`</a>

Indicates a textual response.

Uses a Content-Type of `text/plain` unless overridden by
[`withType`](#withType), [`withHeader`](#withHeader),
or [`withoutHeader`](#withoutHeader).

#### <a name="Json" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L247">`Json :: Object -⁠> Response a b`</a>
#### <a name="Json" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L265">`Json :: JsonValue -⁠> Response a b`</a>

Indicates a JSON response.

Uses a Content-Type of `application/json` unless overridden by
[`withType`](#withType), [`withHeader`](#withHeader),
or [`withoutHeader`](#withoutHeader).
[`withType`](#withType), [`withHeader`](#withHeader).

#### <a name="Render" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L259">`Render :: String -⁠> Object -⁠> Response a b`</a>
#### <a name="Render" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L276">`Render :: String -⁠> Object -⁠> Response a b`</a>

Indicates a response to be rendered using a template. The first argument
is the path to the template file, and the second is the data to inject into
the template. This uses Express' render method under the hood, so you can
configure it globally with `app.set ('view engine', engine)` and
`app.set ('views', path)`.

#### <a name="Redirect" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L271">`Redirect :: String -⁠> Response a b`</a>
#### <a name="Redirect" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L288">`Redirect :: String -⁠> Response a b`</a>

Indicates a redirection. The first argument will be the response status
code, and the second will be the value of the Location header.

Unless overridden by [`withStatus`](#withStatus), the status code will be
set to 301 (Moved Permanently).

#### <a name="Empty" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L283">`Empty :: Response a b`</a>
#### <a name="Empty" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L300">`Empty :: Response a b`</a>

Indicates an empty response. The response status will be set to 204, and
no response body or Content-Type header will be sent.

#### <a name="Next" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L292">`Next :: b -⁠> Response a b`</a>
#### <a name="Next" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L309">`Next :: b -⁠> Response a b`</a>

Indicates that this middleware does not form a response. The supplied value
will be assigned to `res.locals` and the next middleware will be called.

#### <a name="withStatus" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L298">`withStatus :: Number -⁠> Response a b -⁠> Response a b`</a>
#### <a name="withStatus" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L315">`withStatus :: Number -⁠> Response a b -⁠> Response a b`</a>

Configure the status code by setting up a call to [`res.status`][].

#### <a name="withType" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L309">`withType :: String -⁠> Response a b -⁠> Response a b`</a>
#### <a name="withType" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L326">`withType :: String -⁠> Response a b -⁠> Response a b`</a>

Configure the Content-Type by setting up a call to [`res.type`][].

#### <a name="withLocation" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L320">`withLocation :: String -⁠> Response a b -⁠> Response a b`</a>
#### <a name="withLocation" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L337">`withLocation :: String -⁠> Response a b -⁠> Response a b`</a>

Configure the Location header by setting up a call to [`res.location`][].

#### <a name="withLinks" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L331">`withLinks :: StrMap String -⁠> Response a b -⁠> Response a b`</a>
#### <a name="withLinks" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L348">`withLinks :: StrMap String -⁠> Response a b -⁠> Response a b`</a>

Configure the Link header by setting up a call to [`res.links`][].

#### <a name="withCookie" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L342">`withCookie :: CookieOptions -⁠> String -⁠> String -⁠> Response a b -⁠> Response a b`</a>
#### <a name="withCookie" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L359">`withCookie :: CookieOptions -⁠> String -⁠> String -⁠> Response a b -⁠> Response a b`</a>

Configure the Set-Cookie header by setting up a call to [`res.cookie`][].

#### <a name="withClearCookie" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L353">`withClearCookie :: CookieOptions -⁠> String -⁠> Response a b -⁠> Response a b`</a>
#### <a name="withClearCookie" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L370">`withClearCookie :: CookieOptions -⁠> String -⁠> Response a b -⁠> Response a b`</a>

Configure the Set-Cookie header by setting up a call to
[`res.clearCookie`][].

#### <a name="withClearCookie" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L365">`withClearCookie :: String -⁠> String -⁠> Response a b -⁠> Response a b`</a>
#### <a name="withClearCookie" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L382">`withClearCookie :: String -⁠> String -⁠> Response a b -⁠> Response a b`</a>

Append to a header by setting up a call to [`res.append`][].

#### <a name="withHeader" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L376">`withHeader :: String -⁠> String -⁠> Response a b -⁠> Response a b`</a>
#### <a name="withHeader" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L393">`withHeader :: String -⁠> String -⁠> Response a b -⁠> Response a b`</a>

Configure a header by setting up a call to [`res.set`][].

#### <a name="withoutHeader" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L387">`withoutHeader :: String -⁠> Response a b -⁠> Response a b`</a>
#### <a name="withoutHeader" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L404">`withoutHeader :: String -⁠> Response a b -⁠> Response a b`</a>

Removes a header from the Response. Also removes headers that would be
set by functions like [`withType`](#withType). For example:
Expand All @@ -213,7 +213,7 @@ Empty

### Middleware creation utilities

#### <a name="middleware" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L412">`middleware :: (b -⁠> Req -⁠> Future a (Response a b)) -⁠> (Req, Res b, (a -⁠> Undefined)) -⁠> Undefined`</a>
#### <a name="middleware" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L429">`middleware :: (b -⁠> Req -⁠> Future a (Response a b)) -⁠> (Req, Res b, (a -⁠> Undefined)) -⁠> Undefined`</a>

Converts an action to an Express middleware.

Expand All @@ -224,7 +224,7 @@ appropriate mutations to the [`res`][].
If the Future rejects, the rejection reason is passed into `next` for
further [error handling with Express][].

#### <a name="dispatcher" href="https://github.com/fluture-js/fluture-express/blob/v5.0.0/index.js#L426">`dispatcher :: String -⁠> String -⁠> (Req, Res a, (Any -⁠> Undefined)) -⁠> Promise Undefined`</a>
#### <a name="dispatcher" href="https://github.com/fluture-js/fluture-express/blob/v6.0.0/index.js#L443">`dispatcher :: String -⁠> String -⁠> (Req, Res a, (Any -⁠> Undefined)) -⁠> Promise Undefined`</a>

Creates middleware that uses the export from the given file in the given
directory as an "action".
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
//.
//. You can load the EcmaScript module from various content delivery networks:
//.
//. - [Skypack](https://cdn.skypack.dev/fluture-express@5.0.0)
//. - [JSPM](https://jspm.dev/fluture-express@5.0.0)
//. - [jsDelivr](https://cdn.jsdelivr.net/npm/fluture-express@5.0.0/+esm)
//. - [Skypack](https://cdn.skypack.dev/fluture-express@6.0.0)
//. - [JSPM](https://jspm.dev/fluture-express@6.0.0)
//. - [jsDelivr](https://cdn.jsdelivr.net/npm/fluture-express@6.0.0/+esm)
//.
//. ### Usage Example
//.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fluture-express",
"version": "5.0.0",
"version": "6.0.0",
"description": "Create Express middleware using Futures",
"keywords": [
"fluture",
Expand Down

0 comments on commit 5205beb

Please sign in to comment.