Prettynice
Use this module to define your server as a full-fledged program that can send commands, respond to messages, and listen for subscriptions, just like a normal Node program.
Note: If all you want to do is respond to requests with simple responses,
look at Prettynice.SimpleRouter
instead.
Typically you will use defineProgram
in your main
,
and startProgram
in your init
. See below for details.
Or check out some complete example programs that use this module:
Defining your program
Define your Prettynice program.
This will give you a Program
that you can return from your main
function.
If you don't need the full model/update/view cycle, see
Prettynice.SimpleRouter
instead.
The definition of your Prettynice program.
Starting your program
Start your server!
This creates the startup task you can return from your init
function.
Application config. You will pass this to startProgram
.
The task that starts your program.
It should be returned from your init
function.
You will get this from startProgram
, which you can wrap in an
await
if you need to initialize other subsystems (see the
running-tasks example
for an example of this).