fastify
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -8,2 +8,3 @@ 'use strict' | ||
const https = require('https') | ||
const pinoHttp = require('pino-http') | ||
@@ -20,2 +21,6 @@ const supportedMethods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT', 'OPTIONS'] | ||
options.logger = options.logger || {} | ||
options.logger.level = options.logger.level || 'fatal' | ||
const logger = pinoHttp(options.logger) | ||
const router = wayfarer('/404') | ||
@@ -52,2 +57,3 @@ const map = new Map() | ||
function fastify (req, res) { | ||
logger(req, res) | ||
router(stripUrl(req.url), req, res) | ||
@@ -54,0 +60,0 @@ } |
@@ -76,2 +76,3 @@ 'use strict' | ||
res.end() | ||
return | ||
} | ||
@@ -93,2 +94,3 @@ | ||
res.end() | ||
return | ||
} | ||
@@ -95,0 +97,0 @@ |
@@ -61,1 +61,2 @@ 'use strict' | ||
module.exports = { build, validate, serialize } | ||
module.exports.symbols = { payloadSchema, querystringSchema, outputSchema, paramsSchema } |
{ | ||
"name": "fastify", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Fast and low overhead web framework, for Node.js", | ||
"main": "fastify.js", | ||
"scripts": { | ||
"test": "standard | snazzy && tap test/*.test.js" | ||
"test": "standard | snazzy && tap test/*.test.js test/*/*.test.js", | ||
"coverage": "tap --cov --coverage-report=html test/*.test.js test/*/*.test.js", | ||
"coveralls": "tap test/*test.js test/*/*.test.js --cov --coverage-report=text-lcov | coveralls" | ||
}, | ||
@@ -28,22 +30,24 @@ "repository": { | ||
"devDependencies": { | ||
"coveralls": "^2.11.15", | ||
"express": "^4.14.0", | ||
"hapi": "^15.1.1", | ||
"hapi": "^15.2.0", | ||
"koa": "^1.2.4", | ||
"pre-commit": "^1.1.3", | ||
"request": "^2.75.0", | ||
"restify": "^4.1.1", | ||
"request": "^2.79.0", | ||
"snazzy": "^5.0.0", | ||
"standard": "^8.4.0", | ||
"split2": "^2.1.0", | ||
"standard": "^8.6.0", | ||
"take-five": "^1.3.0", | ||
"tap": "^7.1.2" | ||
"tap": "^8.0.1" | ||
}, | ||
"dependencies": { | ||
"ajv": "^4.7.7", | ||
"ajv": "^4.9.0", | ||
"body": "^5.1.0", | ||
"boot-in-the-arse": "^0.3.0", | ||
"fast-json-stringify": "^0.10.0", | ||
"fast-safe-stringify": "^1.1.0", | ||
"fast-json-stringify": "^0.10.1", | ||
"fast-safe-stringify": "^1.1.3", | ||
"pathname-match": "^1.2.0", | ||
"wayfarer": "^6.2.1" | ||
"pino-http": "^2.1.0", | ||
"wayfarer": "^6.3.0" | ||
} | ||
} |
@@ -13,2 +13,3 @@ # Fastify [![Build Status](https://travis-ci.org/mcollina/fastify.svg)](https://travis-ci.org/mcollina/fastify) [![Coverage Status](https://coveralls.io/repos/github/mcollina/fastify/badge.svg?branch=master)](https://coveralls.io/github/mcollina/fastify?branch=master) | ||
* [API](#api) | ||
* [Logging](#logging) | ||
* [Team](#team) | ||
@@ -268,2 +269,21 @@ * [Acknowledgements](#acknowledgements) | ||
<a name="logging"></a> | ||
## Logging | ||
Since Fastify is really focused on performances, we choose the best logger to achieve the goal. **[Pino](https://github.com/pinojs/pino)**! | ||
By default Fastify uses [pino-http](https://github.com/pinojs/pino-http) as logger, with the log level setted to `'fatal'`. | ||
If you want to pass some options to the logger, just pass the logger option to fastify. | ||
You can find all the options [here](https://github.com/pinojs/pino#pinoopts-stream). If you want to pass a custom stream to the Pino instance, just add the stream field to the logger object. | ||
```js | ||
const split = require('split2') | ||
const stream = split(JSON.parse) | ||
const fastify = require('fastify')({ | ||
logger: { | ||
level: 'info', | ||
stream: stream | ||
} | ||
}) | ||
``` | ||
<a name="team"></a> | ||
@@ -270,0 +290,0 @@ ## The Team |
Sorry, the diff of this file is not supported yet
52140
34
1622
322
8
11
3
+ Addedpino-http@^2.1.0
+ Addedansi-styles@3.2.1(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedfast-json-parse@1.0.3(transitive)
+ Addedflatstr@1.0.12(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpino@4.17.6(transitive)
+ Addedpino-http@2.6.2(transitive)
+ Addedpino-std-serializers@2.5.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedpump@3.0.0(transitive)
+ Addedquick-format-unescaped@1.1.2(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsplit2@2.2.0(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedthrough2@2.0.5(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwrappy@1.0.2(transitive)
Updatedajv@^4.9.0
Updatedfast-json-stringify@^0.10.1
Updatedfast-safe-stringify@^1.1.3
Updatedwayfarer@^6.3.0