Registry / devops / apis
library0.1.2jsnpmunverified

Apis is a JavaScript library for building RESTful APIs with WebSocket support. Version 0.1.2 provides a modular architecture built around 'units' and a loader system that automatically assembles application parts. It features flexible settings, advanced routing with contracts and resources, support for multiple servers (HTTP/HTTPS, IPv4/IPv6), cluster and domain support, daemonization, logging, and multiple transports including WebSocket, JSONP, and batch requests. Key differentiators include CORS-enabled by default (with CSRF protection), a range of built-in handlers (authentication, data validation, static files), and client libraries for Node.js and browsers. It is designed for creating web and WebSocket APIs with a RESTful philosophy emphasizing stateless operations and cacheable GET requests.

npm install apis
INSTALL
IMPORT
SIG · APIS
A
apis
devopsjavascriptv0.1.2
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.

apis
import apis from 'apis'
const apis = require('apis')
Default import is the main entry point.
createServer
import { createServer } from 'apis'
Named export for creating servers.
Resource
import { Resource } from 'apis'
Class for defining API resources.

Shows how to import apis, create a server, define a simple GET resource, and start the server.

import apis from 'apis'; import { createServer, Resource } from 'apis'; const server = createServer({ port: 3000, contract: [ Resource.create('/hello', { get(ctx) { ctx.json({ message: 'Hello World' }); } }) ] }); server.start().then(() => console.log('Server running on port 3000'));
Debug
Known issues
gotchaAll resources are CORS-enabled and JSONP-available by default; ensure CSRF protection for authenticated requests.
fix
Enable CSRF protection using built-in mechanisms or disable CORS/JSONP where appropriate.
affects: >=0.0.0
gotchaEvery resource has an 'options' handler by default that exposes resource description; override with null if not desired.
fix
Set 'options' handler to null in resource definition to disable.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'apis'
Package not installed or not in node_modules.
fix
Run 'npm install apis' to install the package.
TypeError: apis.createServer is not a function
Wrong import style; default import does not have createServer directly.
fix
Use named import: import { createServer } from 'apis'
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
24 hits · last 30 days
node
22
OpenAI (training)
1
Resources
packageapis
apis — npm install apis · libregistry