Registry / devops / oly-http

oly-http

JSON →
library1.1.0jsnpmunverified

HTTP Server and Client module for the oly framework (v1.1.0). Wraps Koa for server-side and Axios for client-side HTTP operations, integrated with oly's dependency injection. Stable, part of the oly ecosystem. Differentiator: seamless DI-based injection and configuration, tightly coupled with oly.

npm install oly-http
INSTALL
IMPORT
SIG · OLY-HTTP
O
oly-http
devopsjavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HttpServerProvider
import { HttpServerProvider } from 'oly-http'
const HttpServerProvider = require('oly-http').HttpServerProvider
ESM-only; use named import.
HttpClient
import { HttpClient } from 'oly-http'
import HttpClient from 'oly-http'
Named export, not default.
Kernel
import { Kernel } from 'oly'
import { Kernel } from 'oly-http'
Kernel is from oly, not oly-http.

Creates an oly kernel with HTTP server and client, adds Koa middleware, starts server, sends GET request, logs response.

import { Kernel } from "oly"; import { HttpClient, HttpServerProvider } from "oly-http"; const kernel = Kernel.create({HTTP_SERVER_PORT: 4040}); const server = kernel.get(HttpServerProvider); const client = kernel.get(HttpClient); kernel .configure(() => server.use(ctx => ctx.body = "Hello World")) .start() .then(() => client.get(server.hostname)) .then(console.log);
Debug
Known issues
gotchaRequires oly package as peer dependency
fix
Ensure oly ^1.0.0 is installed alongside oly-http.
affects: >=1.0.0
breakingKernel.create() is synchronous; config and start are async
fix
Use .then() or await after .start() to ensure server is ready.
affects: >=1.0.0
gotchaHttpServerProvider wraps Koa; body must be set via ctx.body = ...
fix
Use Koa-style middleware signatures.
affects: >=1.0.0
deprecatedoly-http 1.x uses axios 0.x; security updates may lag
fix
Monitor axios CVEs; consider upgrading oly-http if newer major version released.
affects: 1.x
Errors
Common errors & fixes
Cannot find module 'oly' or 'oly-http'
Missing npm install of both oly and oly-http
fix
npm install oly oly-http
TypeError: ctx.body is not a function
Using Express-style response methods instead of Koa assignment
fix
Set ctx.body = 'response' (not ctx.send())
Error: listen EADDRINUSE :::4040
Port 4040 already in use
fix
Change port in Kernel.create({HTTP_SERVER_PORT: ...})
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
olyrequiredcore framework required for dependency injection and kernel
Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
oly-http — npm install oly-http · libregistry