Example webapp with Fastify
To complete project setup, do:
npm install
and run with
npm start
then point your browser to localhost:8000
Note that it's possible to let Docker do all inside a container, because all is described in a Dockerfile; see Dockerfile-usage for related commands. Of course you need a local installation of Docker (recent, if possible latest), but nothing other.
To run a development server (with hot reload enabled) instead execute this:
npm run start:dev
For other custom commands look the 'scripts' section inside 'package.json'.
Fastify ^2.1.0 , Node.js 8.15.x or later.
Some features can be configured via environment variables;
if a .env file is found in project root, all its contents
will be loaded into environmental variables.
Supported variables:
FASTIFY_OPTIONS, set Fastify main options at startup, as a JSON string; to change logging level for example use something like: `{ "logger": { "level": "debug" } }' and to remove logging for example use: '{ }'HTTP_PORT, set default HTTP port for the serverHTTP_ADDRESS, set default HTTP address for the serverNATS_SERVER_URL, set the URL for the NATS server (if enabled), or plugin defaultWEBHOOK_SECRET_KEY, set the secret key to require by exposed webhookFEATURE_FAVICON_DISABLE, to disable (not load) related pluginFEATURE_WEBHOOK_DISABLE, to disable (not load) related pluginFEATURE_HEALTHCHECK_DISABLE, to disable (not load) related pluginFEATURE_CLOUDEVENTS_DISABLE, to disable (not load) related pluginFEATURE_CLOUDEVENTS_STRICT_DISABLE, to disable strict mode in generated CloudEvents (if/when related plugin is enabled)FEATURE_NATS_DISABLE, to disable (not load) related plugin if not specified default behavior will be applied.
As a sample, by default (unless disabled) some messages will be sent to a NATS queue, when the web application has started and when a client ask for a page. NATS server by default (in related plugin) is a public one, demo.nats.io.
Licensed under Apache-2.0.