Function sourcesFromFile

  • Creates Swagger document sources for a local file.

    Example

    import createServer from "@egomobile/http-server"
    import { setupSwaggerProxy, sourcesFromFile } from "@egomobile/swagger-proxy"

    async function main() {
    const app = createServer()

    setupSwaggerProxy(app, {
    "baseDocument": {
    "info": {
    "title": "My merged API",
    "version": "1.0.0"
    }
    },

    "sources": [
    ...sourcesFromFile('/path/to/local/file1.json'),
    ...sourcesFromFile('/path/to/local/file2.yaml'),
    ]
    })

    await app.listen(8080)
    }

    main().catch(console.error)

    Returns

    The new fetcher.

    Parameters

    • file: string

      The path to the file.

    Returns SwaggerSourceValue[]

Generated using TypeDoc