koa-morgan
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/koa-morgan package

    1.0.1 • Public • Published

    koa-morgan

    HTTP request logger middleware for koa.
    morgan wrapper for koa's middleware.

    NPM version NPM Downloads Build status Test coverage Dependency status License

    Install

    $ npm install --save koa-morgan

    Usage

    =1.x, 100%, working with morgan and koa-v2

    const fs = require('fs')
    const Koa = require('koa')
    const morgan = require('koa-morgan')
     
    // create a write stream (in append mode)
    const accessLogStream = fs.createWriteStream(__dirname + '/access.log',
                                                 { flags: 'a' })
    const app = new Koa()
     
    // setup the logger
    app.use(morgan('combined', { stream: accessLogStream }))
     
    app.use((ctx) => {
      ctx.body = 'hello, world!'
    })
     
    app.listen(2333)

    =0.x, working with koa-v1

    var koa = require('koa');
    var morgan = require('koa-morgan');
    var app = koa();
     
    app.use(morgan.middleware(format, options));
     

    Keywords

    Install

    npm i koa-morgan

    DownloadsWeekly Downloads

    69,676

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • fundon