Skip to content

Instantly share code, notes, and snippets.

View bogoslavskiy's full-sized avatar

Artem Bogoslavskiy bogoslavskiy

View GitHub Profile
import { Animated, ViewStyle, RegisteredStyle, ScrollViewProps, FlatListProps, SectionListProps } from 'react-native';
export interface IProps {
/**
* A React component that will define the content of the modal.
*/
children?: React.ReactNode;
/**
* A number that will enable the snapping feature and create an intermediate point before opening the modal to full screen.
import * as express from 'express';
import * as mongoose from 'mongoose';
import * as http from 'http';
import { ApolloServer } from 'apollo-server-express';
import config from './config';
import schema from './schema';
const app = express();
version: '3.7'
services:
mongo:
image: mongo:latest
volumes:
- './mongodb_data:/data/db'
ports:
- 27017:27017
const ENV = {
development: {
port: 7000,
mongoURI: 'mongodb://localhost:27017/chat-app',
},
production: {
port: 7000,
mongoURI: 'mongodb://localhost:27017/chat-app',
},
staging: {
[...]
httpServer.listen({ port: config.port }, () => {
console.log(`🚀 Server ready at http://localhost:${config.port}${server.graphqlPath}`)
console.log(`🚀 Subscriptions ready at ws://localhost:${config.port}${server.subscriptionsPath}`)
const connectMongoWithRetry = () => {
mongoose
.connect(config.mongoURI, {
useNewUrlParser: true,
useCreateIndex: true,
import { gql } from 'apollo-server-express';
const typeDefs = gql`
type Message {
_id: ID!
sender_id: String!
senderName: String!
text: String!
date: Timestamp!
}
import { GraphQLScalarType } from 'graphql';
import { Kind, ValueNode } from 'graphql/language';
import { gql } from 'apollo-server';
const parse = (v: string) => {
if (v === undefined || v === null) {
throw new Error('field should be String');
}
const str = String(v);
import { GraphQLScalarType } from 'graphql';
import { Kind, ValueNode } from 'graphql/language';
import { gql } from 'apollo-server';
const parse = (v: string) => {
if (v === undefined || v === null) {
throw new Error('field should be String');
}
return v;
import NEString from './NEString';
import Timestamp from './Timestamp';
export default {
declarations: [
NEString.declaration,
Timestamp.declaration,
],
resolvers: {
...NEString.type,
import { makeExecutableSchema } from 'graphql-tools';
import merge = require('lodash/merge');
import Scalars from './scalars';
// Modules
import Messages from './resolvers/Messages';
const Modules = {
typeDefs: [
Messages.typeDefs,