Skip to content

Instantly share code, notes, and snippets.

View sockol's full-sized avatar
🎯
Focusing

Semur Nabiev sockol

🎯
Focusing
View GitHub Profile
@sockol
sockol / aa179ff0c2bc.js
Last active September 24, 2019 18:11
Get GraphQL Apollo to work with NextJS Server Side Rendering within Docker
import {
ApolloClient,
ApolloLink,
InMemoryCache,
HttpLink
} from 'apollo-boost'
import fetch from 'isomorphic-unfetch'
const isServer = () => typeof window === `undefined`
@sockol
sockol / aa179ff0c2bc-edit.js
Last active September 24, 2019 18:11
Get GraphQL Apollo to work with NextJS Server Side Rendering within Docker
import {
ApolloClient,
ApolloLink,
InMemoryCache,
HttpLink,
} from 'apollo-boost'
const isServer = () => typeof window === `undefined`
const create = (initialState = {}, cookies) => {
@sockol
sockol / mocha-test.js
Last active March 6, 2020 21:37
Unit test file uploads in your Apollo GraphQL Server
const apolloTesting = require(`apollo-server-testing`);
const {
ApolloServer
} = require(`apollo-server-express`);
// see docs at: https://www.apollographql.com/docs/apollo-server/getting-started/
const serverConfig = {
/*
typeDefs,
resolvers,
@sockol
sockol / mocha-resolver.js
Last active September 24, 2019 18:27
Unit test file uploads in your Apollo GraphQL Server
addFile: async (_, options) => {
const {
file,
input
} = options;
try {
const { stream, filename, mimetype } = await file;
const s3File = await someFileStoreService.upload({ stream, filename, mimetype });
@sockol
sockol / mocha-test-better.js
Last active December 13, 2021 20:34
Unit test file uploads in your Apollo GraphQL Server
const apolloTesting = require(`apollo-server-testing`)
const {
ApolloServer
} = require(`apollo-server-express`)
// see docs at: https://www.apollographql.com/docs/apollo-server/getting-started/
const serverConfig = {
/*
typeDefs,
resolvers,