Skip to content

Instantly share code, notes, and snippets.

View akoenig's full-sized avatar
🐝

André König akoenig

🐝
View GitHub Profile
@akoenig
akoenig / index.ts
Last active March 3, 2018 20:02
Medium: M2M in GraphQL context (Factory function for creating the binding)
import { readFile } from "fs";
import { join as joinPath } from "path";
import { promisify } from "util";
import fetch from "node-fetch";
import { makeRemoteExecutableSchema } from "graphql-tools";
import { createHttpLink } from "apollo-link-http";
import { Binding as TelemetryBinding } from "./telemetry";
@akoenig
akoenig / index.ts
Last active March 4, 2018 07:25
Medium: M2M in GraphQL context (Invoking binding factory and perform and execute query)
import { createTelemetryBinding } from "./binding";
const app = async () => {
const telemetry = await createTelemetryBinding(
"https://kqxrmk1pr7.lp.gql.zone/graphql"
);
while (true) {
const userTelemetry = await telemetry.query.user({}, {});
import { compose } from "recompose";
import { graphql, gql } from "react-apollo";
import { ErrorHandler } from "./components";
const NewsList = compose(
graphql(gql`
query news {
id
name
// graphql/index.js
import ApolloClient, { createNetworkInterface } from "react-apollo";
const createClient = ({ endpointUri: uri }) => {
const networkInterface = createNetworkInterface({ uri });
networkInterface.useAfter([{
applyAfterware({ response }, next) {
// Do something with the response ...
// index.js
import { render } from "react-dom";
import { ApolloProvider } from "react-apollo";
import { App } from "./App";
import { createClient } from "./graphql";
const $app = document.getElementById("app");
const client = createClient({
// index.js
import { render } from "react-dom";
import { ApolloProvider } from "react-apollo";
import { App } from "./App";
import { createClient } from "./graphql";
const $app = document.getElementById("app");
const client = createClient({
// graphql/index.js
import ApolloClient, { createNetworkInterface } from "react-apollo";
const createClient = ({ endpointUri: uri, onError }) => {
const networkInterface = createNetworkInterface({ uri });
networkInterface.useAfter([{
applyAfterware({ response }, next) {
if (response.status === 500) {
FROM node:8-alpine
LABEL maintainer="André König <[email protected]>"
RUN apk add --update curl iptables sudo && \
addgroup -S app && adduser -S -g app app
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh", "--"]
#!/usr/bin/env sh
#
# iptables configuration
#
# The following allows in- and outbound traffic
# within a certain `CIDR` (default: `192.168.0.0/24`),
# but blocks all other network traffic.
#
ACCEPT_CIDR=${ALLOWED_CIDR:-192.168.0.0/24}
apiVersion: v1
kind: Namespace
metadata:
name: prisma