Comparing version 0.13.1 to 0.14.0
@@ -26,9 +26,2 @@ <h1 align="center">Fastify</h1> | ||
``` | ||
<a name="server-methods"></a> | ||
#### Some useful methods | ||
- `fastify.server`: The Node core server object | ||
- `fastify.ready(callback)`: Function called when all the plugins has been loaded. | ||
- `fastify.listen(callback)`: Starts the server on the given port after all the plugins are loaded, internally waits for the `.ready()` event. The callback is the same as the Node core. | ||
- `fastify.route(options)`: check [here](https://github.com/fastify/fastify/blob/master/docs/Routes.md). | ||
- `fastify.close(callback)`: call this function to close the server instance and run the [`'onClose'`](https://github.com/fastify/fastify/blob/master/docs/Hooks.md#on-close) hook. | ||
@@ -35,0 +28,0 @@ <a name="schema"></a> |
@@ -91,2 +91,5 @@ 'use strict' | ||
// exposes the routes map | ||
fastify[Symbol.iterator] = iterator | ||
return fastify | ||
@@ -260,2 +263,34 @@ | ||
function iterator () { | ||
var entries = map.entries() | ||
var it = {} | ||
it.next = function () { | ||
var next = entries.next() | ||
if (next.done) { | ||
return { | ||
value: null, | ||
done: true | ||
} | ||
} | ||
var value = {} | ||
var methods = {} | ||
value[next.value[0]] = methods | ||
// out methods are saved Uppercase, | ||
// so we lowercase them for a better usability | ||
for (var method in next.value[1]) { | ||
methods[method.toLowerCase()] = next.value[1][method] | ||
} | ||
return { | ||
value: value, | ||
done: false | ||
} | ||
} | ||
return it | ||
} | ||
// TODO: find a better solution than | ||
@@ -262,0 +297,0 @@ // copy paste the code of the constructor |
{ | ||
"name": "fastify", | ||
"version": "0.13.1", | ||
"version": "0.14.0", | ||
"description": "Fast and low overhead web framework, for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "fastify.js", |
@@ -39,2 +39,3 @@ <div align="center"> | ||
* <a href="https://github.com/fastify/fastify/blob/master/docs/Getting-Started.md"><code><b>Getting Started</b></code></a> | ||
* <a href="https://github.com/fastify/fastify/blob/master/docs/Server-Methods.md"><code><b>Server Methods</b></code></a> | ||
* <a href="https://github.com/fastify/fastify/blob/master/docs/Routes.md"><code><b>Routes</b></code></a> | ||
@@ -41,0 +42,0 @@ * <a href="https://github.com/fastify/fastify/blob/master/docs/Logging.md"><code><b>Logging</b></code></a> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139678
72
3737
81