Version 1.0, after all these years!
- CommonJS support has been dropped. The previous version of this library had compatibility with both CJS and ESM. The effort and pain no longer feels worth it, so we're dropping CommonJS support.
- Now requires Node 18.
- Version string was broken for CJS build.
- Export the package version
- Now has a ESM and CommonJS build.
- New version string:
Curveball/0.21.0 (esm)
andCurveball/0.21 (cjs)
depending on how the library was used.
- Tests are now run for CommonJS and ESM environments.
- New version string:
Curveball/0.21.0 (esm)
andCurveball/0.21 (cjs)
depending on how the library was used. - Add a ugly workaround for the
accept
library.
- Almost all tests are passing, aside from anything that uses 'accept'.
- CommonJS was still broken due to a bad copy paste.
- ESM actually too.
- With a fresh perspective on a new day, this is a likely fix for 'commonjs' but perhaps not yet ESM.
- Attempt 6 at making this work. I think this is the one.
- Attempt 5 at making this work. Exports aren't picked up yet.
- Incorrect export again!
- Fix
package.json
exports
property for ESM.
cjs
/esm
folders were missing from package gzip.
- This package now supports ESM. Both CommonJS and ESM versions are provided in the npm package.
- Added
setGlobalOrigin
andgetGlobalOrigin
functions, this lets users get direct access to the 'origin detection algoritm' and avoid reimplementing it.
- No changes since alpha.1
- Exporting
HeadersInterface
,HeadersObject
,headerHelpers
andBody
. - No longer default-exporting Application.
- This package is forked from @curveball/core and will be the future 'core' engine for curveball. This new core is smaller, and has all node-specific APIs removed, so it may be used in other server APIs as well.
- Added
Application.fetch()
, which lets you use the standardRequest
andResponse
classes to execute requests in curveball.
- Now requires Node 14.
Application
,Context
,Request
andResponse
now have aorigin
property. This defaults defaults tohttp://localhost
. This can be overridden by settingApplication.origin
, or setting aCURVEBALL_ORIGIN
environment variable.PUBLIC_URI
also works, but it's mainly a fallback for earlier examples and recommendations.Request
andContext
now have aabsoluteUrl
property. This is calculated based on the request path and theorigin
.- BC Break: Due to the new
origin
property, allRequest
andResponse
classes now have an extra constructor argument. This means if you ever manually constructed any of these, there's a small change you'll need to make. Typescript should point all these problems! - If
CURVEBALL_TRUSTPROXY
is set,request.ip()
will trust proxies by default, and return the ip of the real client instead of the proxy.
Identical release as the previous alpha.
- The
Context
interface has been removed, and theBaseContext
class is renamed toContext
. This is a BC break, but should only be an issue if you used theContext
interface directly.BaseContext
is still exported but simply aliased toContext
. This alias will be removed from a future version. This change should make ite asier to use interface declaration merging to extend Context. - The
ws
dependency has been updated to version 8. There are some breaking changes in this release. The most likely you'll hit is that incoming messages are now of typeBuffer
instead ofstring
. Check out the ws changelog for more details.
listen()
now starts a WebSocket service on the same port by default.listenWs()
is now deprecated, and will be removed in a future version.- JSON is now pretty-printed by default.
Happy birthday Mom!
- Update all dependencies and ensure compatibility with latest Typescript changes.
- Updated lint rules
- Make file update
- Updated dependencies
- Releasing on Github packages.
- Request.body is no longer optional, which will help with typing. It can still
be explicitly set to
null
.
- This release is identical to the last
- BC Break:
Request.body
is now typed asunknown
instead ofany
. This forces users to either validate the body, or cast toany
. - It's now possible to write directly to response streams by setting response.body to a callback.
- Curveball now required Node 12.
esModuleInterop
flag is no longer required to use curveball.
- #155 -
listen
andlistenWs
now both have a secondhost
argument to bind to a specific interface. (@Nicholaiii) - #145 -
request.headers
andresponse.headers
now have agetMany()
function to get a list of header values for a given header name. (@Nicholaiii)
- Republish of 1.14.1, which was missing some changes.
- types ws package is now non-devDependency
- Native Websocket support. If enabled,
ctx
will now have awebSocket
property.
- Removed
Request
andResponse
interfaces again. They actually made it more difficult to extend.
- Both
Request
andResponse
are now typescript interfaces. This will allow plugins to extends them via interface declaration merging. - Everything is now compiled with the typescript 'strict' mode, which caused some internal refactoring.
- Added utilities to check
If-Match
,If-None-Match
,If-Modified-Since
,If-Unmodified-Since
. - Typescript target is now
es2019
instead ofesnext
to ensure that older Node.js versions are supported. - Added a workaround to make sure the package works around a bug in
@types/node@13
.
- Set
Content-Type
totext/plain
for errors that fall without being caught by an exception handling middleware.
Context
is no longer a class, it's an interface. It's default implementation is nowBaseContext
. This allows plugins to modify the interface and add new features.
- Added a
redirect()
function toContext
andResponse
objects, making it easier to set a status-code and location header in one step. - Support for more
Prefer
parameters:depth-noroot
,safe
,transclude
.
- Fix a bug in HTTP/2 Push. Resources with query parameters in their path were not pushed correctly.
- The
is()
function will now also match wildcards, such asimage/*
.
rawBody()
had an incorrect type. It should always return aBuffer
if the first argument is omitted.
- The server now sets a
application/hal+json
content-type if nothing else was set. This fixes a regression from 0.9.0.
Request
andResponse
types are now abstract classes instead of interfaces. This removes a bunch of duplication.Request
objects now have aprefer()
method for quickly reading out the values from the RFC7240Prefer
header.
- Correctly set status for HTTP exceptions in sub-requests.
- Fixed a regression from 0.8.3.
- Correctly set status for HTTP exceptions in sub-requests.
- Subrequests should behave as regular requests and catch any exceptions.
- Updated all dependecies.
- Stricter typescript rules.
- Now exporting an
invokeMiddleware
function that can be used to chain and call mutltiple middlewares. - Application will now by default throw a
NotFound
exception if nothing handled a HTTP request.
- It's now possible to pass objects as Middlewares. If an object has a member
thats the
middlewareCall
symbol, it will call that instead. - The package now exports a
invokeMiddleware
function, which is a convenience method to call many middlewares. - #70: It's possible to set
Response.body
to astream.Readable
object. - #91: Bugfix: The
accept()
function ignored changes made my middlewares toAccept
header.
- The
Context
object now has anip
method that can be used to get the ip address of the client that's connecting. - The
Request
andResponse
objects now have anis()
method that can be used to easily check theContent-Type
header of the object. For exampleRequest.is('json')
will return true forapplication/hal+json
. - The
Headers
object now has ahas()
method.
- Request and Response object are now generic.
Response<T>
implies the body property has typeT
. ctx.status
is now writable.
- #74: Added
method
,path
,status
,accepts
,push
,sendInformational
, andquery
to Context object. These properties and methods all forward to the request or response object. - #78: By default the Application will return with a
404
response, unless a middleware updates the status or a body was set. - Tests will now error when a node version under 8.11.2 is used. They broke before as well, but it's more explicit now about why.
Application.buildContextFromHttp
is now public.
- #71: Fixed error messages when a HTTP/2 client disables or refuses a push late in the process.
- #72: Refactored node-specific code into its own directory.
- #57:
Response.type
is now settable.
- #4: Support for HTTP/2 push via the
Response.push()
method. - #62: It's now possible to do internal sub-requests without going through the
HTTP stack, with
Application.subRequest()
. - Added
MemoryRequest
andMemoryResponse
. - #56:
Response.body
may now benull
. - Renamed package to
@curveball/core
.
- Added License, Code of Conduct.
- #52: Support for
Buffer
and arbitrary objects inresponse.body
. The latter will automatically get converted to JSON.
- #5: Support for informational status codes such as
100 Continue
and103 Early Hints
for both HTTP/1 and HTTP/2. - #28: HTTP2 support.
- #34:
Application
is now the default export. - #47:
Application.callback
now returns a callback instead of implementing it. This makes it a bit easier to deal withthis
scope and is also consistent with Koa. - #48: Added a setter for
Response.status()
. - Now exporting the
Middleware
type.
- #19: Added
Request.rawBody()
method. - #33: Added
Request.accept()
method. - #35: Added
Request.type
andResponse.type
. - #36: Added
Request.query
. - #37:
Response.body
now has typeany
. - #38: Added
Context.state
. - #39: Added
Application.callback
.
- Set
script
andtypes
correctly inpackage.json
.
- Fixed npm package distribution. Was shipping the wrong files.
- Created
Request
,Response
,Application
,Context
,Headers
classes. - Basic framework works
- First published on npm.js to claim package name.