@curveball/core
Advanced tools
Comparing version 0.11.1 to 0.11.2
Changelog | ||
========= | ||
0.11.2 (2020-03-09) | ||
------------------- | ||
* Added utilities to check `If-Match`, `If-None-Match`, `If-Modified-Since`, | ||
`If-Unmodified-Since`. | ||
* Typescript target is now `es2019` instead of `esnext` 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`. | ||
0.11.1 (2020-03-03) | ||
@@ -5,0 +16,0 @@ ------------------- |
/// <reference types="node" /> | ||
import EventEmitter from 'events'; | ||
import { EventEmitter } from 'events'; | ||
import http from 'http'; | ||
@@ -4,0 +4,0 @@ import Context from './context'; |
@@ -7,3 +7,3 @@ "use strict"; | ||
const http_errors_1 = require("@curveball/http-errors"); | ||
const events_1 = __importDefault(require("events")); | ||
const events_1 = require("events"); | ||
const http_1 = __importDefault(require("http")); | ||
@@ -43,3 +43,3 @@ const base_context_1 = __importDefault(require("./base-context")); | ||
exports.invokeMiddlewares = invokeMiddlewares; | ||
class Application extends events_1.default { | ||
class Application extends events_1.EventEmitter { | ||
constructor() { | ||
@@ -46,0 +46,0 @@ super(...arguments); |
@@ -9,3 +9,4 @@ import { default as Application, invokeMiddlewares, Middleware, middlewareCall } from './application'; | ||
import Response from './response'; | ||
import { conditionalCheck } from './conditional'; | ||
export default Application; | ||
export { Application, BaseContext, Context, Headers, invokeMiddlewares, middlewareCall, Middleware, Request, Response, MemoryRequest, MemoryResponse, }; | ||
export { Application, BaseContext, Context, conditionalCheck, Headers, invokeMiddlewares, middlewareCall, Middleware, Request, Response, MemoryRequest, MemoryResponse, }; |
@@ -29,3 +29,5 @@ "use strict"; | ||
exports.Response = response_1.default; | ||
const conditional_1 = require("./conditional"); | ||
exports.conditionalCheck = conditional_1.conditionalCheck; | ||
exports.default = application_1.default; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@curveball/core", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "Curveball is a framework writting in Typescript for Node.js", | ||
@@ -36,6 +36,6 @@ "main": "dist/index.js", | ||
"@types/accepts": "^1.3.5", | ||
"@types/chai": "^4.2.9", | ||
"@types/chai": "^4.2.10", | ||
"@types/co-body": "0.0.3", | ||
"@types/mocha": "^7.0.1", | ||
"@types/node": "^10.17.16", | ||
"@types/mocha": "^7.0.2", | ||
"@types/node": "^10.17.17", | ||
"@types/node-fetch": "^2.5.5", | ||
@@ -50,3 +50,3 @@ "@types/sinon": "^7.5.2", | ||
"tslint": "^6.0.0", | ||
"typescript": "^3.8.2" | ||
"typescript": "^3.8.3" | ||
}, | ||
@@ -66,3 +66,12 @@ "types": "dist/", | ||
"node": ">=9.4" | ||
}, | ||
"mocha": { | ||
"require": "ts-node/register", | ||
"recursive": true, | ||
"extension": [ | ||
"ts", | ||
"js", | ||
"tsx" | ||
] | ||
} | ||
} |
@@ -57,11 +57,17 @@ Curveball | ||
* [Body Parser](https://github.com/curveball/bodyparser). | ||
* [Controller](https://github.com/curveball/controller). | ||
* [Access logs](https://github.com/curveball/access-log). | ||
* [Sessions](https://github.com/curveball/session). | ||
* [Simple controllers - ideal for resource-oriented routing](https://github.com/curveball/controller). | ||
* [Generating application/problem+json responses](https://github.com/curveball/problem). | ||
AWS Lambda support | ||
------------------- | ||
See [aws-lambda](https://github.com/curveball/aws-lambda). | ||
Project status | ||
-------------- | ||
The project is currently alpha quality. I would love some feedback on developer | ||
ergonomics. Things might change before a 1.0 release. | ||
The project is currently in beta. It might go through a few more changes, but | ||
the project is mostly stable. It's ready for production. | ||
@@ -297,2 +303,26 @@ | ||
Other features | ||
-------------- | ||
Use the `checkConditional` function to verify the following headers: | ||
* `If-Match` | ||
* `If-None-Match` | ||
* `If-Modified-Since` | ||
* `If-Unmodified-Since`. | ||
Signature: | ||
```typescript | ||
checkConditionial(req: RequestInterface, lastModified: Date | null, etag: string | null): 200 | 304 : 412; | ||
``` | ||
This function returns `200` if the conditional passed. If it didn't, it will | ||
return either `304` or `412`. The former means you'll want to send a | ||
`304 Not Modified` back, the latter `412 Precondition Failed`. | ||
`200` does not mean you _have_ to return a `200 OK` status, it's just an easy | ||
way to indicate that all all conditions have passed. | ||
[1]: https://expressjs.com/ "Express" | ||
@@ -299,0 +329,0 @@ [2]: https://koajs.com/ "Koa" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
119190
62
2245
334