asljs-kb-srv
v0.1.2
Published
The kb-srv web server: a markdown library in an editor, its documents rendered and edited in the browser.
Maintainers
Readme
kb-srv
Part of Alexandrite Software Library - a set of high-quality, performant JavaScript libraries and tools for everyday use.
Overview
asljs-kb-srv is the kb-srv web server: a markdown library in an editor in
the browser, its documents as a tree of folders, searched, rendered and edited.
The server sends the library's data, and the KB app of asljs-kb-app renders
it. It reads the library on every request and keeps no index.
Installation
npm install -g asljs-kb-srvUsage
kb-srvserves the library of each kb.json in the working folder, or in its
subfolders, at the address it prints, until stopped with Ctrl+C; the editor
switches between them. kb-srv --working-dir ~/kb looks for them in ~/kb. A
project is configured by its own kb.json only; --library, --state-dir,
KB_LIBRARY and KB_STATE_DIR are options of kb.
As a library:
import { createApp } from 'asljs-kb-srv';
import { createLoggerProvider } from 'asljs-logging-pino';
import { serve } from 'asljs-appbase';
const loggerProvider = createLoggerProvider('KB_LOG_');
const app = await createApp(
{ cwd: process.cwd(), base: '/', env: process.env, loggerProvider });
const server = await serve(app.handler, { port: 8080 });createApp(context) is the application as an EditorApp of asljs-appbase,
the editor with the library as its plugin, mountable at any base; close()
stops the syncs of its libraries. createView(environment, options) is the
handler of one library, and isServed(path) says whether a library path is
served: no dot file or folder, and nothing in node_modules. main(args,
environment) is the kb-srv command.
Further reading
- kb-srv - the command, the editor, its routes, and editing.
- Requirements - what the server guarantees, as rq requirements.
Related packages
- asljs-kb-cli - the
kbcommand line. - asljs-kb-mcp - the
kb-mcpMCP server. - asljs-kb-app - the KB app, which the server serves.
- asljs-kb - the knowledge base functions, as a library.
- asljs-ui-editor - the editor and its plugins.
- appbase - the document server behind
kb-srv.
License
See LICENSE for details.
