Giter Site home page Giter Site logo

luis-sousa-pinto / krakendio-krakend-martian Goto Github PK

View Code? Open in Web Editor NEW

This project forked from krakend/krakend-martian

0.0 0.0 0.0 163 KB

Integrate the martian lib in the KrakenD framework

Home Page: http://www.krakend.io/

License: Apache License 2.0

Go 100.00%

krakendio-krakend-martian's Introduction

KrakenD martian

The krakend-martian package integrates the martian project into the KrakenD framework.

How to use it

Add your martian DSL definition under the "github.com/devopsfaith/krakend-martian" namespace of the backend section of the config file

"extra_config": {
  "github.com/devopsfaith/krakend-martian": {}
}

More details here: https://github.com/google/martian#modifiers-all-the-way-down

Check the example folder for a complete demo.

Example

  • Build and run krakend edition with martian
$ cd example
$ go install ./...
$ GOPATH/bin/example -c example/krakend.json -d -p 8000
  • Send a request to the configured endpoint
$ curl -i 127.0.0.1:8000/supu
  HTTP/1.1 200 OK
  Cache-Control: public, max-age=0
  Content-Type: application/json; charset=utf-8
  X-Krakend: Version undefined
  X-Krakend-Completed: true
  Date: Tue, 17 Jul 2018 11:56:33 GMT
  Content-Length: 19

  {"msg":"you rock!"}

And check the logs of the KrakenD: the request modifiers have done their job! See how {"msg":"you rock!"} was added to the payload.

[KRAKEND] ▶ DEBUG config: {[0xc4201839a0] 3s 3.6µs [] 8000 2  map[github_com/devopsfaith/krakend-gologging:map[prefix:[KRAKEND] stdout:true level:DEBUG syslog:false]] 0s 0s 0s 0s false false 0 250 0s 0s 0s 0s 0s 0s false <nil> true 1}
[KRAKEND] ▶ DEBUG Debug enabled
[KRAKEND] ▶ DEBUG Method: GET
[KRAKEND] ▶ DEBUG URL: /__debug/supu
[KRAKEND] ▶ DEBUG Query: map[]
[KRAKEND] ▶ DEBUG Params: [{param /supu}]
[KRAKEND] ▶ DEBUG Headers: map[User-Agent:[KrakenD Version undefined] Content-Length:[19] Content-Type:[] X-Forwarded-For:[127.0.0.1] Accept-Encoding:[gzip]]
[KRAKEND] ▶ DEBUG Body: {"msg":"you rock!"}
[GIN] | 200 |     313.798µs |       127.0.0.1 | GET      /__debug/supu
[GIN] | 200 |    1.556445ms |       127.0.0.1 | GET      /supu

krakendio-krakend-martian's People

Contributors

kpacha avatar taik0 avatar alombarte avatar bartoszgolek avatar corinnekrych avatar trojanh avatar bgpearson avatar rin8888work avatar ondram avatar terraskye 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.