const Identity = x => ({
map: f => Identity(f(x)),
fold: f => f(x),
inspect: () => `Identity(${x})`
});
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From server/graph/queries/post/posts.ts | |
import { | |
GraphQLList, | |
} from 'graphql'; | |
import types from '../../types'; | |
import PostModel from '../../../db/models/post'; | |
export default { | |
type: new GraphQLList(types.postType), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
GraphQLInputObjectType, | |
GraphQLString, | |
GraphQLID, | |
GraphQLNonNull, | |
} from 'graphql'; | |
export default new GraphQLInputObjectType({ | |
name: 'CommentInput', | |
fields: () => ({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Comment Model Schema and related GraphQL Schema | |
// From /server/db/models/comment.ts | |
import mongoose from 'mongoose'; | |
const CommentSchema = new mongoose.Schema({ | |
author: String, | |
body: String, | |
post: { | |
type: String, | |
ref: 'Post', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import { ApolloClient, createNetworkInterface } from 'apollo-client'; | |
import { renderToString, renderToStaticMarkup } from 'react-dom/server'; | |
import { match, RouterContext } from 'react-router'; | |
import morgan from 'morgan'; | |
import express from 'express'; | |
import compression from 'compression'; | |
import path from 'path'; | |
import { ApolloProvider } from 'react-apollo'; | |
import store from '../client/store'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'babel-polyfill'; | |
import path from 'path'; | |
import fs from 'fs'; | |
import * as express from 'express'; | |
import { graphql } from 'graphql'; | |
import { introspectionQuery } from 'graphql/utilities'; | |
import bodyParser from 'body-parser'; | |
import cors from 'cors'; | |
import { graphiqlExpress, graphqlExpress } from 'graphql-server-express'; | |
import schema from './graph'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
type Maybe<T,U> = (pattern: { | |
some(x: T): U; | |
none(): U; | |
}) => U; | |
function map<A,B,C>(maybe: Maybe<A,C>, f: (a: A) => B): Maybe<B,C> { | |
return function(pattern) { | |
return maybe({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type FeedbackAction = 'FEEDBACK_SUBMISSION_INITIATION' | 'FEEDBACK_SUBMISSION_MESSAGE' | 'FEEDBACK_SUBMISSION_ERROR'; // etc. etc. | |
interface IAction<P> { | |
type: FeedbackAction; | |
payload: P; | |
}; | |
interface IFeedbackState { | |
error: Error; | |
message: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type alias Model = | |
{ error: Maybe String | |
, message: Maybe String | |
, isSubmitting: Bool | |
} | |
type alias Error = | |
{ message: String } | |
type Msg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const initialState = { | |
error: null, | |
message: null, | |
isSubmitting: false, | |
modal: { | |
isVisible: false, | |
}, | |
}; | |
const feedbackReducer = |