Set server framework

By default the library will be configured to run with express. If you are going to use another server framework, you have to change the configuration accordingly. There are 2 ways to do this:

  1. Set the key-value pair "framework": "$frameworkName" in a configuration file:

    {
        "framework": "fastify"
    }
    
  2. Set the server framework from a logger instance by calling:

    import log, { Framework } from "cf-nodejs-logging-support";
    
    log.setFramework(Framework.Fastify);
    

Our supported server frameworks are:

  • Express: declare as express or use Framework.Express
  • Connect: declare as connect or use Framework.Connect
  • Fastify: declare as fastify or use Framework.Fastify
  • Node.js HTTP: declare as plainhttp or use Framework.PlainHttp