Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

krakend config example

{
	"version": 2,
	"name": "Express API Gateway",
	"cache_ttl": "3600s",
	"timeout": "7200ms",
	"extra_config": {
		"github_com/devopsfaith/krakend-cors": {
			"allow-origins": ["*"],
			"allow-methods": ["GET", "POST", "DELETE", "PUT"],
			"expose_headers": ["Origin", "Content-Length", "Content-Type", "Authorization", "grant"],
			"allow_credentials": true,
			"max-age": "24h"
		},
		"github.com/devopsfaith/krakend-ratelimit/juju/router": {
			"maxRate": 0
		},
		"github.com/devopsfaith/krakend-jsonschema": {
			"type": "object",
			"properties": {
				"status": {
					"type": "string"
				},
				"code": {
					"type": "number"
				},
				"method": {
					"type": "string"
				},
				"message": {
					"type": "string"
				}
			}
		}
	},
	"endpoints": [
		{
			"endpoint": "/create",
			"method": "POST",
			"concurrent_calls": 1,
			"header_to_pass": ["Origin", "Content-Type", "Authorization", "grant"],
			"output_encoding": "no-op",
			"backend": [
				{
					"host": ["http://webapp:3000"],
					"method": "POST",
					"url_pattern": "/api/v1/book/create",
					"encoding": "no-op",
					"is_collection": false,
					"disable_host_sanitize": false
				}
			]
		},
		{
			"endpoint": "/results",
			"method": "GET",
			"concurrent_calls": 1,
			"header_to_pass": ["Origin", "Content-Type", "Authorization", "grant"],
			"output_encoding": "no-op",
			"backend": [
				{
					"host": ["http://webapp:3000"],
					"method": "GET",
					"url_pattern": "/api/v1/book/results",
					"encoding": "no-op",
					"is_collection": false,
					"disable_host_sanitize": false
				}
			]
		},
		{
			"endpoint": "/users",
			"method": "GET",
			"concurrent_calls": 1,
			"header_to_pass": ["Origin", "Content-Type", "Authorization", "grant"],
			"output_encoding": "json",
			"backend": [
				{
					"host": ["https://jsonplaceholder.typicode.com"],
					"method": "GET",
					"url_pattern": "/users",
					"encoding": "json",
					"is_collection": true,
					"disable_host_sanitize": false
				}
			]
		},
		{
			"endpoint": "/posts",
			"method": "POST",
			"concurrent_calls": 1,
			"header_to_pass": ["Origin", "Content-Type", "Authorization", "grant"],
			"output_encoding": "json",
			"backend": [
				{
					"host": ["https://jsonplaceholder.typicode.com"],
					"method": "POST",
					"url_pattern": "/posts",
					"encoding": "json",
					"is_collection": false,
					"disable_host_sanitize": false
				}
			]
		}
	]
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: mongoose get elements that contain substring 
Javascript :: how to set random dice image with js 
Javascript :: combine p5 with react 
Javascript :: The toUpperCase JavaScript string method 
Javascript :: react-native-image-picker npm 
Javascript :: json.parse 
Javascript :: how to global a variable in javascript 
Javascript :: display a div only seconds js 
Javascript :: persistent bugger javascript code 
Javascript :: to 2 decimal places javascript 
Javascript :: discord.js v12 how to set owner commands 
Javascript :: brain.js 
Javascript :: Device detector in react js 
Javascript :: angular-chart.js 
Javascript :: array swap method javascript 
Javascript :: how add class to ckeditor image 
Javascript :: Laravel react 404 routes 
Javascript :: ckeditor ignore contenteditable 
Javascript :: form status angular 
Javascript :: jquery clone object 
Javascript :: convert string with dot or comma as decimal separator to number in javascript 
Javascript :: set range background color google script multiple colors 
Javascript :: javascript timeline 
Javascript :: Split string on the first white space occurrence 
Javascript :: react multiple classname 
Javascript :: array 
Javascript :: delete request reaxt 
Javascript :: chrome extension contextmenus 
Javascript :: javascript for each 
Javascript :: getting cannot call a class as a function 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =