@whook/example
TypeScript icon, indicating that this package has built-in type declarations

18.0.3 • Public • Published

@whook/example

A basic Whook server

GitHub license

This is a basic Whook server demonstrating the various usages of the Whook framework to build REST APIs.

Usage

To run the server in production:

npm it
NODE_ENV=production APP_ENV=production npm start

You can understand deeply this repository and Whook's internal by simply reading the Architecture Notes. The "See in context" links drive your directly in the concerned implementation so that you can just see the code that explains the notes.

Feel free to continue creating architecture notes and to regenerate the markdown file by running:

npm run architecture

Dev

Start the server in development:

# Simple dev mode
npm run dev

# Watch mode
npm run watch

Create a new endpoint / service / provider or command:

npx whook create

Play with the REPL:

npm run repl

Generate the dependency injection graph (here, for the putTime handler):

npm run --silent whook -- __inject putTime,mermaid > DEPENDENCIES.mmd;
docker run --rm -u `id -u`:`id -g` -v $(pwd):/data minlag/mermaid-cli -i DEPENDENCIES.mmd -o DEPENDENCIES.mmd.svg;

List available commands:

## In dev mode
npm run dev -- ls
## With built files
npx whook ls

Generate API types:

npm run apitypes

Debug

Execute a handler in isolation:

npx whook handler --name putEcho --parameters '{"body": { "echo": "YOLO!" }}'

Debug whook internals:

DEBUG=whook npm run dev

Debug knifecycle internals (dependency injection issues):

DEBUG=knifecycle npm run dev

Authors

License

MIT

Package Sidebar

Install

npm i @whook/example

Weekly Downloads

194

Version

18.0.3

License

MIT

Unpacked Size

326 kB

Total Files

166

Last publish

Collaborators

  • nfroidure