To Login
ssh -i <private-key-file/pem> ec2-user@[ec2-hostname].amazonaws.com- Install Node JS & pm2 Ref:
| /** | |
| * Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
| * It was requested to be introduced at as part of the jsonwebtoken library, | |
| * since we feel it does not add too much value but it will add code to mantain | |
| * we won't include it. | |
| * | |
| * I create this gist just to help those who want to auto-refresh JWTs. | |
| */ | |
| const jwt = require('jsonwebtoken'); |
To Login
ssh -i <private-key-file/pem> ec2-user@[ec2-hostname].amazonaws.com| query IntrospectionQuery { | |
| __schema { | |
| queryType { name } | |
| mutationType { name } | |
| types { | |
| ...FullType | |
| } | |
| directives { | |
| name | |
| description |
| # Monkey Patch: Add a count field to all connections by default. | |
| # Note, I tried to make this nicer, where it would just call the original method and then add a count field, | |
| # but the challenge outlasted my patience. So I just replaced the whole method. TODO: better way to do this | |
| module GraphQL | |
| module Relay | |
| module ConnectionType | |
| def self.create_type(wrapped_type, edge_type: wrapped_type.edge_type, edge_class: GraphQL::Relay::Edge, nodes_field: ConnectionType.default_nodes_field, &block) | |
| custom_edge_class = edge_class | |
| # Any call that would trigger `wrapped_type.ensure_defined` |
| # Define an instrumentation that performs the caching | |
| class CachingInstrumentation | |
| def instrument(_type, field) | |
| return field unless field.metadata.include?(:cache_proc) | |
| old_resolver = field.resolve_proc | |
| new_resolver = -> (obj, args, ctx) do | |
| # Get the caching key | |
| cache_key = field.metadata[:cache_proc].call(obj, args, ctx) | |
| # Define an instrumentation that performs the caching | |
| class CachingInstrumentation | |
| def instrument(_type, field) | |
| return field unless field.metadata.include?(:cache_proc) | |
| old_resolver = field.resolve_proc | |
| new_resolver = -> (obj, args, ctx) do | |
| # Get the caching key | |
| cache_key = field.metadata[:cache_proc].call(obj, args, ctx) | |
| #!/usr/bin/env python3 | |
| # Copyright (c) 2019 acidzebra | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # https://www.apache.org/licenses/LICENSE-2.0 | |
| # |
| source 'https://rubygems.org' | |
| gem "graphql", github: "rmosolgo/graphql-ruby", branch: "subscriptions" | |
| gem "sinatra" | |
| gem "thin" |