GithubHelp home page GithubHelp logo

fastly / compute-starter-kit-javascript-openapi-validation Goto Github PK

View Code? Open in Web Editor NEW
9.0 12.0 2.0 123 KB

OpenAPI Validation Starter Kit for Fastly Compute (JavaScript)

Home Page: https://developer.fastly.com/solutions/starters/

License: MIT License

JavaScript 100.00%
compute-starter fastly-oss-tier1

compute-starter-kit-javascript-openapi-validation's Introduction

OpenAPI Validation Starter Kit for JavaScript

Deploy to Fastly

An application template for validating requests against an OpenAPI 3.x definition, in JavaScript, for Fastly Compute.

OpenAPI, briefly

The OpenAPI Specification (OAS – originally based on the Swagger Specification) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, additional documentation, or inspection of network traffic.

An OpenAPI definition is a document (or set of documents) that defines or describes an API.

How this starter kit helps

This starter kit makes it possible to define custom request handling logic at the edge, based on whether a request matches an OpenAPI definitions. This means:

✅ Relieving load on origins

✅ Improved API security

Usage

Replace the contents of src/definition.json with your own OpenAPI 3.x definition, and change any references to httpbin.org to your origin in fastly.toml – by replacing the url in local_server.backends.origin, and the address (hostname) in setup.backends.origin.

Then run fastly compute serve to try out this Compute app on your local machine, or fastly compute publish to publish a new Compute service.

Request handling

The default application behavior is to only forward valid requests to the origin, and return a synthetic HTTP 400 response for invalid requests.

OpenAPI validation errors are logged in both cases.

To forward all requests to the origin, set the constant REJECT_INVALID_REQUESTS to false.

For more details about other starter kits for Compute, see the Fastly Developer Hub

Security issues

Please see our SECURITY.md for guidance on reporting security-related issues.

compute-starter-kit-javascript-openapi-validation's People

Contributors

doramatadora avatar harmony7 avatar integralist avatar jakechampion avatar journie-fastly avatar triblondon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

triblondon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.