Gathering detailed insights and metrics for @podium/hapi-layout
Gathering detailed insights and metrics for @podium/hapi-layout
npm install @podium/hapi-layout
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
12,781
Last Day
1
Last Week
10
Last Month
103
Last Year
2,770
1 Stars
289 Commits
1 Forks
3 Watching
10 Branches
10 Contributors
Minified
Minified + Gzipped
Latest Version
4.0.9
Package Id
@podium/hapi-layout@4.0.9
Unpacked Size
14.68 kB
Size
4.33 kB
File Count
5
NPM Version
10.8.3
Node Version
20.17.0
Publised On
23 Sept 2024
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-16.7%
10
Compared to previous week
Last month
-40.1%
103
Compared to previous month
Last year
-22.5%
2,770
Compared to previous year
Hapi plugin for @podium/layout.
Module for building @podium/layout servers with hapi. For writing layouts, please see the Podium documentation.
1$ npm install @podium/hapi-layout @podium/layout
The v3.x of this module require Hapi v19 or newer and node v12 or newer. Please use v2.x of this module for Hapi v18 or older.
Build a simple layout server including a single podlet:
1import HapiLayout from '@podium/hapi-layout'; 2import Layout from '@podium/layout'; 3import Hapi from '@hapi/hapi'; 4 5const server = Hapi.Server({ 6 host: 'localhost', 7 port: 7000, 8}); 9 10const layout = new Layout({ 11 pathname: '/', 12 name: 'layout', 13}); 14 15const podlet = layout.client.register({ 16 name: 'myPodlet', 17 uri: 'http://localhost:7100/manifest.json' 18}); 19 20await server.register({ 21 plugin: new HapiLayout(), 22 options: layout, 23}); 24 25server.route({ 26 method: 'GET', 27 path: layout.pathname(), 28 handler: (request, h) => { 29 const incoming = request.app.podium; 30 const result = await podlet.fetch(incoming); 31 return h.podiumSend(result.content); 32 }, 33}); 34 35server.start(); 36console.log("Server running on %s", server.info.uri);
The plugin is registered by passing an instance of this plugin to the hapi
server .register()
method together with an instance of the @podium/layout
class.
1await server.register({ 2 plugin: new HapiLayout(), 3 options: new Layout(), 4});
On each request @podium/layout will run a set of operations on the request and
create an [incoming] object. The [incoming] object is stored at
request.app.podium
which is accessible inside request handlers.
1server.route({ 2 method: 'GET', 3 path: '/', 4 handler: async (request, h) => { 5 const incoming = request.app.podium; 6 const result = await podlet.fetch(incoming); 7 return h.podiumSend(result.content); 8 }, 9});
Its possible to pass request bound parameters to @podium/context parsers by
setting an object at request.app.params
.
Example: To pass a value to the @podium/context locale parser it should be set
on request.app.params.locale
by a extension executed previously of this
extension.
This method will wrap the given fragment in a default document template before dispatching.
See document template for further information.
Copyright (c) 2019 FINN.no
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-06
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More