Skip to content

Instantly share code, notes, and snippets.

View mohsen89z's full-sized avatar

Mohsen ZareZardeyni mohsen89z

  • Tillhub
  • Berlin, Germany
View GitHub Profile
@mohsen89z
mohsen89z / Interface.ts
Last active August 22, 2019 07:36
Database Connection Manager
import { MongoDBConfig } from './Config'
import * as mongoose from 'mongoose'
import * as bluebird from 'bluebird'
import { logger } from './Logger'
export enum ConnectionStatus {
DISCONNECTED = 'DISCONNECTED',
CONNECTED = 'CONNECTED',
ERROR = 'ERROR',
}
@mohsen89z
mohsen89z / webpack.config.js
Created May 9, 2019 10:59
Resolve .graphql import for medium
module.exports = {
...
module: {
...
rules: [
...
{
test: /\.graphql$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader',
@mohsen89z
mohsen89z / tsconfig.json
Created May 9, 2019 10:59
Resolve .graphql import for medium
{
"compilerOptions": {
...
"typeRoots": ["node_modules/@types", "src/@types"],
},
"files": ["src/@types/graphql.d.ts"],
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
@mohsen89z
mohsen89z / index.ts
Last active July 4, 2019 11:15
Resolve .graphql import for medium
import { ApolloServer } from 'apollo-server'
import { resolvers } from './graphql/resolvers'
import typeDefs from './graphql/Query.graphql'
const server = new ApolloServer({
typeDefs,
resolvers,
})
server.listen().then(({ url }) => {
@mohsen89z
mohsen89z / graphql.d.ts
Last active November 24, 2019 21:11
Resolve .graphql import for medium
declare module '*.graphql' {
import { DocumentNode } from 'graphql'
const Schema: DocumentNode
export = Schema
}
@mohsen89z
mohsen89z / graphql.d.ts
Created May 9, 2019 09:23
Resolve .graphql import in webpack and typescript
declare module '*.graphql' {
import { DocumentNode } from 'graphql';
const MyQuery: DocumentNode;
export { MyQuery };
export default MyQuery;
}