Function sourcesFromUrl

  • Creates Swagger document sources from an URL.

    Example

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

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

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

    "sources": [
    ...sourcesFromUrl("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml"),
    ]
    })

    await app.listen(8080)
    }

    main().catch(console.error)

    Returns

    The sources.

    Parameters

    • rawUrl: string

      The raw URL.

    Returns SwaggerSourceValue[]

Generated using TypeDoc