This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| /some/:id/path => /some/{id}/path | |
| /another/:example/for/:you => /another/{example}/for/{you} | |
| */ | |
| function formatParamUrl (url) { | |
| var start = url.indexOf('/:') | |
| if (start === -1) return url |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Pino = require('pino') | |
| const spawn = require('child_process').spawn | |
| const { MONGO_ADDRESS } = process.env | |
| function eventLogger () { | |
| const mongoLog = spawnMongoLog() | |
| mongoLog.on('error', err => { throw err }) | |
| mongoLog.stdout.pipe(process.stdout) | |
| const pino = Pino({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| api_1 | /usr/src/app/node_modules/mongodb/lib/url_parser.js:89 | |
| api_1 | throw new Error('double colon in host identifier'); | |
| api_1 | ^ | |
| api_1 | | |
| api_1 | Error: double colon in host identifier | |
| api_1 | at module.exports (/usr/src/app/node_modules/mongodb/lib/url_parser.js:89:13) | |
| api_1 | at connect (/usr/src/app/node_modules/mongodb/lib/mongo_client.js:442:16) | |
| api_1 | at Function.MongoClient.connect (/usr/src/app/node_modules/mongodb/lib/mongo_client.js:241:3) | |
| api_1 | at Object.<anonymous> (/usr/src/app/node_modules/pino-mongodb/pino-mongodb.js:25:13) | |
| api_1 | at Module._compile (module.js:570:32) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"status":"ok"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function send(payload) { | |
| // ... | |
| runOnResponseHook(this._req, this.res, this.handle._hook.onResponse, payload) | |
| } | |
| function wrapReplySend (reply, payload) { | |
| return function send (payload) { | |
| // return reply.send(payload) | |
| return runOnResponseHook(reply._req, reply.res, reply.handle._hook.onResponse, payload) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* eslint-disable no-useless-return */ | |
| 'use strict' | |
| const pump = require('pump') | |
| const safeStringify = require('fast-safe-stringify') | |
| const xtend = require('xtend') | |
| const validation = require('./validation') | |
| const serialize = validation.serialize | |
| const statusCodes = require('./status-codes.json') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ▶ node test/track-multi.test.js | |
| TAP version 13 | |
| # Subtest: # subscription | |
| 1..7 | |
| {"pid":70267,"hostname":"Geyser.fritz.box","level":20,"time":1498569625469,"msg":"listening","address":{"address":"192.168.20.143","family":"IPv4","port":62876},"v":1} | |
| {"pid":70267,"hostname":"Geyser.fritz.box","level":30,"time":1498569625478,"msg":"node up","id":null,"address":{"address":"192.168.20.143","family":"IPv4","port":62876},"v":1} | |
| ok 1 - main up | |
| {"pid":70267,"hostname":"Geyser.fritz.box","level":30,"time":1498569625484,"msg":"subscribing to a group of peers","id":null,"receiver":{"id":"cJFzNdb8R2qwDl16zNsx+Q/0","topic":"#","key":"#"},"peers":[],"v":1} | |
| ok 2 - should not error | |
| {"pid":70267,"hostname":"Geyser.fritz.box","level":20,"time":1498569625486,"msg":"listening","address":{"address":"192.168.20.143","family":"IPv4","port":62877},"v":1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| router.get('/test/%s/prova', /^hello$/gi, (request, response, params) => { | |
| // some code | |
| }) | |
| // └── / | |
| // └── test | |
| // └── /^hello$/gi | |
| // └── prova (GET) | |
| // multiple regex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fastify.decorate('genericPage', (req, reply) => { | |
| reply.code(404).type('text/html').send(` | |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| </head> | |
| <body> | |
| <p>Not found :(</p> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict' | |
| const fp = require('fastify-plugin') | |
| const reusify = require('reusify') | |
| function checkAuth (fastify, opts, next) { | |
| fastify.decorate('auth', auth) | |
| next() | |
| } |
OlderNewer