danielb2 / blipp Goto Github PK
View Code? Open in Web Editor NEWblipp is a simple hapi plugin to display the routes table at startup
blipp is a simple hapi plugin to display the routes table at startup
showAuth only displays authorization strategies correctly if they are specifically noted in the routes.
Is this me or is it a bug? As soon as I add showAuth to the options I get an error: "showAuth" is not allowed
(I use glue) Here's my manifest:
const manifest = { server: {}, connections: [ {host: "localhost", port: 8000} ], registrations: [ {plugin: "hapi-auth-basic"}, {plugin: "blipp", options: {showAuth: true}} ] }
Now the interesting part. If I remove showAuth from options and then go to the module /node_modules/blipp/lib/index.js and edit line 11 to be showAuth: Joi.boolean().default(true) // instead of false
then it works!
How can this be?
Using typescript. Registering blipp with this option configuration:
{
plugin: require("blipp"),
options: { showAuth: true, showScope: true }
}
Getting this error (took out my root directory):
Unhandled rejection { AssertionError [ERR_ASSERTION]: {
"showAuth": true,
"showScope" [1]: true
}
[1] "showScope" is not allowed
at new AssertionError (/internal/assert.js:268:11)
at Object.exports.assert (/node_modules/hoek/lib/index.js:736:11)
at Object.exports.register (/node_modules/blipp/lib/index.js:20:10)
at internals.Server.register (/node_modules/hapi/lib/server.js:431:35)
at init (/index.ts:17:16)
at Object.<anonymous> (/index.ts:45:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Module.m._compile (/node_modules/ts-node/src/index.ts:439:23)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.require.extensions.(anonymous function) [as .ts] (/node_modules/ts-node/src/index.ts:442:12)
generatedMessage: false,
name: 'AssertionError [ERR_ASSERTION]',
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: '==' }
edit: I'm using blipp version 3.0.0
/home/andrew/Desktop/projects/github/photobox/services/service-members/node_modules/hapi/node_modules/hoek/lib/index.js:663
throw new Error(msgs.join(' ') || 'Unknown error');
^
Error: A callback function is required to register a plugin
at Object.exports.assert (/home/andrew/Desktop/projects/github/photobox/services/service-members/node_modules/hapi/node_modules/hoek/lib/index.js:663:11)
at internals.Plugin.register (/home/andrew/Desktop/projects/github/photobox/services/service-members/node_modules/hapi/lib/plugin.js:154:10)
at Object.<anonymous> (/home/andrew/Desktop/projects/github/photobox/services/service-members/server.js:16:8)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
You can define HapiJS routes that are only internal
http://hapijs.com/api#route-configuration
This was introduced in 9.1.0:
hapijs/hapi@66730f9
However, these internal routes are showing up on blipp. It'd be a nice option to be able to hide those. Perhaps the option could be hideInternalRoutes
and default to false? I'd be more than happy to make the PR for this. It would push the devDependencies up a major version from 8.x.x. to 9.x.x. Given Hapi is currently on 15, this seems like it'd be safe. Thoughts?
Can the repository field be added to the package.json for this module so the below warning is not shown by npm?
npm WARN package.json [email protected] No repository field.
Hi, can you please update the version. It is still 2.1.3.
Thanks a lot!
If scope like following, 'Cannot read property 'toString' of undefined' error occurs
scope: ['+a', '+b']
That's an idea for enhancement.
Currently we show what are the strategies for each route, using the { showAuth: true } option. How about if we add { showScope: true } to the options as well and list these values too?
I would be more than hapi to work on that :))
That's pretty much about it. hapi
package is now at @hapi/hapi
and joi at @hapi/joi
Could you perhaps add an option to the option to exclude certain routes? I'm using the hapi-swagger plugin, and now blipp shows the /docs and /documentation routes in the route table.
This might be outside this project's scope, but I'm wondering if there's any way to add custom properties to the table?
For example; in the below route, I make use of different plugins for access permissions, ideally I would like to display these permissions during startup in the table.
{ method: 'POST', path: '/api/example', config: { description: 'Example route', auth: 'bearer', plugins: { access: { mustInclude: ['primary'] }, validate: { headers: Joi.object().options({ allowUnknown: true }) } }, handler: function() { } }
Yes, using blipp is really easy and straightforward, but I think that it would be great to have a simple demo that runs via $ npm run demo
:)
This would help new contributors to test/explore the project without monkey-patching the dependency on their existing projects. Also, it is a good first issue for such new contributors.
show label and port of connection and show all available routes for each separate one
Hapijs 8.x
Have not confirmed if this is a hapijs feature or bug just thought its was worth note.
// here # 2 will be used, #1 ignored.
server.route({
config: { description: "descrip 1" },
config: { description: "descrip 2" }
});
Hi ๐
I love this tiny plugin and I want to keep using it with the latest version of Hapi. Unfortunately, it introduces many breaking changes, so multiple versions will have to be supported afterwards.
I see that there is no recent activity on this repository, so I am opening this issue to ask: would you accept my PR if I take this assignment? ๐
We need to undo some of the changes in #41:
warning blipp > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning blipp > @hapi/[email protected]: Switch to 'npm install joi'
warning blipp > @hapi/joi > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning blipp > @hapi/joi > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning blipp > @hapi/joi > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning blipp > @hapi/joi > @hapi/topo > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning blipp > @hapi/joi > @hapi/[email protected]: Moved to 'npm install @sideway/address'
@hapi/joi
-> joi
@hapi/hoek
to latestA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.