How to use the openapi-backend.default function in openapi-backend

To help you get started, we’ve selected a few openapi-backend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anttiviljami / openapi-backend / examples / express / index.js View on Github external
const OpenAPIBackend = require('openapi-backend').default;
const express = require('express');
const app = express();
app.use(express.json());

// define api
const api = new OpenAPIBackend({
  definition: {
    openapi: '3.0.1',
    info: {
      title: 'My API',
      version: '1.0.0',
    },
    paths: {
      '/pets': {
        get: {
          operationId: 'getPets',
          responses: {
            200: { description: 'ok' },
          },
        },
      },
      '/pets/{id}': {
github anttiviljami / openapi-backend / examples / koa / index.js View on Github external
const OpenAPIBackend = require('openapi-backend').default;
const Koa = require('koa');
const bodyparser = require('koa-bodyparser');
const app = new Koa();
app.use(bodyparser());

// define api
const api = new OpenAPIBackend({
  definition: {
    openapi: '3.0.1',
    info: {
      title: 'My API',
      version: '1.0.0',
    },
    paths: {
      '/pets': {
        get: {
          operationId: 'getPets',
          responses: {
            200: { description: 'ok' },
          },
        },
        post: {
          operationId: 'createPet',
github anttiviljami / openapi-backend / examples / serverless-azure / handler / index.js View on Github external
const OpenAPIBackend = require('openapi-backend').default;

// define api
const api = new OpenAPIBackend({
  definition: {
    openapi: '3.0.1',
    info: {
      title: 'My API',
      version: '1.0.0',
    },
    paths: {
      '/pets': {
        get: {
          operationId: 'getPets',
          responses: {
            200: { description: 'ok' },
          },
        },
      },
      '/pets/{id}': {

openapi-backend

Build, Validate, Route, Authenticate and Mock using OpenAPI definitions. Framework-agnostic

MIT
Latest version published 3 months ago

Package Health Score

86 / 100
Full package analysis

Popular openapi-backend functions