A basic Whook server
This is a basic Whook server demonstrating the various usages of the Whook framework to build REST APIs.
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
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
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