Skip to content

Instantly share code, notes, and snippets.

View kevinswiber's full-sized avatar
🍄
lizard person

Kevin Swiber kevinswiber

🍄
lizard person
View GitHub Profile
@kevinswiber
kevinswiber / 1-install.sh
Last active March 1, 2021 09:58
Kubernetes resources for standing up Express Gateway
#!/bin/bash
kubectl create -f https://gist.githubusercontent.com/kevinswiber/e6a8245930676c3da3448b2bb79f23fd/raw/0869b72410851e2ab02d0c1c30443f4083345066/configmap.yaml
kubectl create -f https://gist.githubusercontent.com/kevinswiber/e6a8245930676c3da3448b2bb79f23fd/raw/0869b72410851e2ab02d0c1c30443f4083345066/deployment.yaml
kubectl create -f https://gist.githubusercontent.com/kevinswiber/e6a8245930676c3da3448b2bb79f23fd/raw/0869b72410851e2ab02d0c1c30443f4083345066/service.yaml
@kevinswiber
kevinswiber / gateway.config.jsonnet
Last active December 7, 2017 23:21
Using Jsonnet with Express Gateway configuration
/*
Run:
$ HTTPBIN_URL=https://httpbin.org jsonnet -V HTTPBIN_URL \
-o ./config/gateway.config.json \
./config/gateway.config.jsonnet
*/
{
http: {
port: 8080

Keybase proof

I hereby claim:

  • I am kevinswiber on github.
  • I am kevinswiber (https://keybase.io/kevinswiber) on keybase.
  • I have a public key ASBYsnxT49ZGkj4cQONOh67Bib3D71sgcRb3oSiuP7gtOQo

To claim this, I am signing this object:

@kevinswiber
kevinswiber / backends.js
Last active February 6, 2024 18:56
Express Gateway Example with Multiple Services
const express = require('express');
const forum = express();
forum
.get('/healthz', (req, res, next) => {
res.send({ name: 'forum', status: 'healthy' });
next();
})
.get('/d/:id', (req, res, next) => {
@kevinswiber
kevinswiber / petstore-minimal-optimized.hcl
Last active August 29, 2020 15:13
OpenAPI Spec in HCL
swagger = "2.0"
info {
version = "1.0.0"
title = "Swagger Petstore"
description = "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification"
terms_of_service = "http://swagger.io/terms"
contact {
name = "Swagger API Team"
@kevinswiber
kevinswiber / interop.go
Created July 26, 2016 17:22
Interop file for using libnode from Golang.
package interop
/*
#cgo CFLAGS: -I${SRCDIR}/../
#cgo LDFLAGS: -L${SRCDIR}/../ -lhello
#include <stdlib.h>
#include <string.h>
#include <node_c.h>
static char** create_argv_array(int array_size) {
@kevinswiber
kevinswiber / siren.apib
Last active May 11, 2017 00:44
Siren described in MSON for API Blueprint
# Data Structures
## Entity (object)
An Entity is a URI-addressable resource that has properties and actions
associated with it. It may contain sub-entities and navigational links.
### Properties
- class (array[string], optional)
Describes the nature of an entity's content based on the current
representation. Possible values are implementation-dependent and
@kevinswiber
kevinswiber / siren.schema.json
Last active May 25, 2019 20:28
JSON Schema for Siren Hypermedia Format
{
"id": "http://sirenspec.org/schema#",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Entity",
"description": "An Entity is a URI-addressable resource that has properties and actions associated with it. It may contain sub-entities and navigational links.",
"type": "object",
"properties": {
"class": {
"description": "Describes the nature of an entity's content based on the current representation. Possible values are implementation-dependent and should be documented.",
"type": "array",
@kevinswiber
kevinswiber / siren_api.yml
Last active September 7, 2022 21:02
Siren definitions for Open API Specification
swagger: '2.0'
info:
title: Siren API
description: Template for a Siren API
version: '0.1.0'
schemes:
- http
- https
basePath: /
produces:
@kevinswiber
kevinswiber / server.js
Last active March 9, 2016 22:17
Authorization Zetta stream topics in multiplexed event stream.
var zetta = require('zetta');
var Photocell = require('zetta-photocell-mock-driver');
zetta()
.name('kevin-mbp')
.use(Photocell)
.use(function(runtime) {
var broker = runtime.httpServer.eventBroker;
var saved = broker._publishStreamEnabledClient;