Giter Site home page Giter Site logo

jalfresi / mustacheproxyd Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 6 KB

A HTTP proxy that transcodes origin JSON response bodies to HTML via mustache templates. This is useful for producing HTML output for a JSON API without modifying the API responses directly.

Go 98.94% HTML 1.06%
proxy golang go http server mustache

mustacheproxyd's Introduction

Mustacheproxyd

A HTTP proxy that transcodes origin JSON response bodies to HTML via mustache templates. This is useful for producing HTML output for a JSON API without modifying the API responses directly.

Download

You can download the latest release. Currently only OSX is supported. Other supported OS will come soon.

Configuration

Configuration is accomplished using a CSV file with the following columns:

Guard RegExp URL Target URL Mustache template filename
/users/(.*) http://example.com/$1 ./templates/$1.mustache
/(.*)/(.*) http://$1.example.com/$2 ./templates/$1/$2.mustache

Guard RegExp URL

Requested URLs must match the supplied pattern before they are processed. Requests that do not match any pattern return HTTP 404.

Target URL

The target URL to proxy the request to. RegExpression expansion may occur in the target URL. Expansion occurs per request.

Mustache template filename

The mustache template filename to use when trnascoding the response body from the target URL. RegExpression expansion may occur in the mustache template filename. Expansion occurs per request.

There may have multiple rules, one per row in the configuration CSV.

Usage

Mustacheproxyd has two command line options. They are:

  • host: The proxy listening hostname and port. Defaults to "127.0.0.1:12345"
  • config: Filepath of the configurtion CSV. Defaults to "./config.csv"

For example:

mustacheproxyd --host="127.0.0.1:12345" --config="./config.csv"

mustacheproxyd's People

Contributors

jalfresi avatar

Watchers

 avatar James Cloos avatar James Main avatar

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.