Releases: fluture-js/fluture-express
Version 6.0.1
Version 6.0.0
Body
type (adding a new Json constructor), and the way equality between to values of type Body
is determined.
Version 5.0.0
Version 5.0.0
This version is a partial rework of the library to allow users to use more of the features normally available in Express. See #31 for the changes in code.
✨ New Features
Most of Express' interface for modifiying the Response head is now available
res.status
throughwithStatus
res.type
throughwithType
res.location
throughwithLocation
res.links
throughwithLinks
res.cookie
throughwithCookie
res.clearCookie
throughwithClearCookie
res.append
throughwithHeaderPart
res.set
throughwithHeader
There's also a new withoutHeader
function to remove specific headers from a Response.
⚠️ Breaking Changes
The internal structure of the Response
type changed
If you were manually interpreting values of type Response
, for example by using the .cata
method, then this change will affect you. For standard usage of this library, this change shouldn't affect you.
The middleware and dispatch functions now expect a curried input function
Instead of (req, locals) => /* Future Response */
, middleware now looks like locals => req => /* Future Response */
-app.use (middleware ((req, locals) => (
+app.use (middleware (locals => req => (
resolve (Empty)
))
The Stream
constructor takes different arguments
- It no longer takes the response code and the mime type as arguments.
- It no longer takes a
Readable
instance directly, but rather aFuture Error Readable
. This allows the value created via theStream
constructor to be passed around safely (instances ofReadable
throw an error after a short timeout if no listerners are attached).
- Stream (202) ('image/jpeg') (fs.createReadStream ('./cat.jpeg'))
+ withStatus (202) (withType ('image/jpeg') (Stream (Future.ecanse (fs.createReadStream) ('./cat.jpeg'))))
The Json
constructor no longer takes the response code
- Json (202) ({hello: world})
+ withStatus (202) (Json ({hello: world}))
The Render
constructor no longer takes the response code
- Render (202) ('template') ({hello: world})
+ withStatus (202) (Render ('template') ({hello: world}))
The Redirect
constructor no longer takes the response code
- Redirect (303) ('example.com')
+ withStatus (303) (Redirect ('example.com'))
Version 4.1.0
🛠️ Package metadata improvements: Expand Fluture version range, fix tags, exports, etc.