netzo/lib
β
The netzo/lib
module is a library of apis
, handlers
, middleware
and utils
to streamline development of custom internal tools. The library is written in TypeScript and can be used in both TypeScript and JavaScript projects.
import { netzo } from 'https://deno.land/x/netzo/mod.ts'
const api = netzo({ apiKey: NETZO_API_KEY })
// GET https://api.netzo.io/users
const users = await api.users.get()
// PATCH https://api.netzo.io/users/12
const user = await api.users[12].patch({ name: 'John' })
import { netzo } from 'https://deno.land/x/netzo/mod.ts'
const api = netzo({ apiKey: NETZO_API_KEY })
// GET https://api.netzo.io/users
const users = await api.users.get()
// PATCH https://api.netzo.io/users/12
const user = await api.users[12].patch({ name: 'John' })
Modules β
The library is organized into the following modules (subdirectories):
netzo/lib
: the main module that exports all other modules fromnetzo/lib/mod.ts
netzo/lib/apis
: pre-configured clients for popular HTTP APIs (you can always create a new client withcreate-api
)netzo/lib/components
: a library of UI components specifically designed for building internal tools.netzo/lib/handlers
: common callback function called when the application receives a request to the specified route (endpoint) and HTTP methodnetzo/lib/middleware
: like handlers, but executed beforehand (in order) if URL route pattern is matched (great for e.g. authentication, logging, serving static files, etc)netzo/lib/plugins
: great for adding functionality to fresh (e.g. injecting scripts and stylesheets, customizing render pipeline, etc)netzo/lib/utils
: utility functions used internally by the library, but exported in case you need them
Usage β
You can import the latest
version of the library directly as follows from mod.ts
, the module entry point or import a specific version directly, for example vX.Y.Z
. For example, to import the lib/apis/netzo
submodule:
import { netzo } from 'https://deno.land/x/netzo/mod.ts'
import { netzo } from 'https://deno.land/x/netzo/mod.ts'
or import a specific version directly, for example vX.Y.Z
:
import { netzo } from 'https://deno.land/x/[email protected]/mod.ts'
import { netzo } from 'https://deno.land/x/[email protected]/mod.ts'
Pinning module version
It is recommended to pin to a specific version when importing/exporting modules. This will ensure that your program does not break when a new version (with breaking changes) is published.
Getting latest
module version
Visit the module's registry directly for the latest
version and copy-paste the URL you're redirected to. To get the URL of the latest version visit deno.land/x/netzo.
Type Definitions β
Refer to src/types.ts
for the type definitions of this module.