• Creates a new middleware that extracts query parameters from URL and writes the data to 'query' property of request context as key/value pairs.

    Returns UniqueHttpMiddleware

    The new middleware.

    Example

    import assert from 'assert'
    import createServer, { IHttpRequest, IHttpResponse, query } from '@egomobile/http-server'

    const app = createServer()

    // try to access via: /?foo=bar
    app.get('/', [query()], async (request: IHttpRequest, response: IHttpResponse) => {
    assert.strictEqual(typeof request.query!.get('foo'), 'string')
    })

    await app.listen()

Generated using TypeDoc