
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
koa-hap-client
Advanced tools
the koa-hap client js for borwser and node.js side[D[D[D[Dserver-[2~side.
koa-hap-client is the ajax library for Hap protocol. it's use with server-side koa-hap as suite. to build hap application as quickly.
npm install koa-hap-client
// file: /api/hello.js
// Hap Service "hello" binding to url "/api/hello".
export async index({ name }) {
return `Hello ${name}!`
}
<!-- call the hap service, url: "/api/hello", params: { name: "World" }. -->
<script src="node_modules/koa-hap-client/dist/hap.js"></script>
<script>
// create api caller.
var api = hap('/api', {
//...with axios options
})
api.hello({ name: 'World' }).then(function (result) {
document.write(result); // Hello World!
}).catch(function (err) {
document.write(err);
});
//// and you can use default axios options aslo.
////hap.api.hello({ name: 'World' }).then((result)=> {
//// document.write(result);
////}).catch(function (err) {
//// document.write(err);
////});
</script>
import hap from 'koa-hap-client';
const api = hap('/api', {});
async () => {
let result = await api.hello({ name: 'World' });
//// or with then default axios options
//// result = hap.api.hello({ name: 'World' });
}
pls see koa-hap-example
hap(baseUrl, config)
| param | type | descript |
|---|---|---|
| baseUrl | string | the hap service url |
| config | object | axios request config |
return hap with config.
. operatorthen . operator is auto transform member path to url like this:
////hap.a.b.c.d.e({})
//// POST /a/b/c/d/e {}
const api = hap('/api', {})
api.example.hello({ name: "World" })
// POST /api/example/hello { "name": "World" }
FAQs
the koa-hap client js for borwser and node.js side[D[D[D[Dserver-[2~side.
The npm package koa-hap-client receives a total of 0 weekly downloads. As such, koa-hap-client popularity was classified as not popular.
We found that koa-hap-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.