Skip to content

Instantly share code, notes, and snippets.

View mehuled's full-sized avatar
🎯
Focusing

Mehul Sharma mehuled

🎯
Focusing
View GitHub Profile
@mehuled
mehuled / spec.json
Created April 23, 2024 23:46
spec.json
{"_type":"export","__export_format":4,"__export_date":"2024-04-23T21:08:40.399Z","__export_source":"insomnia.desktop.app:v8.6.1","resources":[{"_id":"req_226992a607b94aae99bfd40496bdf823","parentId":"fld_9ab4a6bf488643358ee7f458f83540cf","modified":1713906072804,"created":1713824992526,"url":"localhost:8080/services","name":"Create Service","description":"","method":"POST","body":{"mimeType":"","text":"{\n \"name\": \"Razorpay API\"\n}"},"parameters":[],"headers":[],"authentication":{"type":"apikey","key":"x-auth-token","value":"admin_token","addTo":"header","disabled":false},"metaSortKey":-1713824992633,"isPrivate":false,"pathParameters":[],"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_9ab4a6bf488643358ee7f458f83540cf","parentId":"wrk_7744aa1f967c406a94a9128d22c5b291","modified":1713825067426,"created":1713824992525,"name":"Konnect","description"
function plugin:access(plugin_conf)
_G.emmy = {}
_G.emmy.fixPath = function(path)
return string.gsub(path, '/usr/local/kong/plugins/', '/{path_to_working_directory}/')
end
package.cpath = package.cpath .. ';/usr/local/emmy/?.so'
local dbg = require('emmy_core')
dbg.tcpListen('localhost', 9966)
function plugin:access(plugin_conf)
package.cpath = package.cpath .. ';/usr/local/emmy/?.so'
local dbg = require('emmy_core')
dbg.tcpListen('localhost', 9966)
-- Wait for IDE connection
dbg.waitIDE()
-- your custom code here
FROM kong/kong:latest
# Ensure any patching steps are executed as root user
USER root
RUN apt-get update
# Add custom plugin to the image
RUN mkdir -p /usr/local/kong/plugins
FROM kong/kong:latest
# Ensure any patching steps are executed as root user
USER root
RUN apt-get update
RUN apt-get install -y git curl
RUN mkdir -p /usr/local/kong/plugins
local typedefs = require "kong.db.schema.typedefs"
local PLUGIN_NAME = "add-header"
local schema = {
name = PLUGIN_NAME,
fields = {
-- the 'fields' array is the top-level entry with fields defined by Kong
-- If you're not sure your plugin is executing, uncomment the line below and restart Kong
-- then it will throw an error which indicates the plugin is being loaded at least.
--assert(ngx.get_phase() == "timer", "The world is coming to an end!")
---------------------------------------------------------------------------------------------
-- In the code below, just remove the opening brackets; `[[` to enable a specific handler
--
-- The handlers are based on the OpenResty handlers, see the OpenResty docs for details
-- on when exactly they are invoked and what limitations each handler has.
FROM kong/kong:latest
@mehuled
mehuled / docker-compose.yml
Created April 14, 2024 12:31
simple docker-compose to run kong locally
services:
postgres:
image: postgres:13
restart: always
environment:
POSTGRES_USER: kong
POSTGRES_PASSWORD: kong
POSTGRES_DB: kong
ports:
- "5432:5432"
@mehuled
mehuled / classification.md
Last active February 28, 2021 17:58
23 Popular Design patterns and their abstract definitions
Scope Creational Structural Behavioral
Class Factory Method Interpreter
Template Method
Object Abstract FactoryBuilderPrototypeSingleton AdapterBridgeCompositeDecoratorFacadeProxy Chain Of ResponsiblityCommandIteratorMediatorMementoFlyweightObserver