You can use these scripts to setup SetlX.js for contribution:
Clone this gist into a new folder:
git clone https://gist.github.com/f666bc027e6ed10af9f918d2008a6e12.git setlxjs
switch into the newly created directory:
<html> | |
<head> | |
<title>Interview Example</title> | |
</head> | |
<link rel="preconnect" href="https://fonts.googleapis.com" /> | |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | |
<link rel="preconnect" href="https://fonts.googleapis.com" /> | |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | |
<link | |
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=Space+Grotesk:wght@400;500&display=swap" |
// TODO: Skip tables without an id field? | |
module.exports = function LoadByIdsPlugin(builder) { | |
builder.hook('GraphQLInputObjectType:fields', (fields, build, context) => { | |
const { | |
scope: { isPgCondition, pgIntrospection: table }, | |
fieldWithHooks, | |
} = context; | |
if (!isPgCondition || !table || table.kind !== 'class') { | |
return fields; | |
} |
loadCommentsResolver :: Aff Post -> Unit -> Context -> Aff (Array Comment) | |
loadCommentsResolver affPost args context = affPost >>= \post -> | |
loadCommentsByPostId post.id context.dbConnection | |
postType :: GraphQL.ObjectType Context (Maybe Post) | |
postType = | |
GraphQL.objectType | |
"Post" | |
(Just "A blog post that is persisted in the database.") | |
{ comments: | |
GraphQL.field | |
(GraphQL.nonNull $ GraphQL.list $ GraphQL.nonNull GraphQL.string) | |
(Just "The title of this blog post.") | |
{ max: |
const { ApolloServer } = require('apollo-server'); | |
const { GraphQLSchema, GraphQLObjectType, GraphQLString } = require('graphql'); | |
const Query = new GraphQLObjectType({ | |
name: 'Query', | |
description: 'The query operation entry type.', | |
fields: { | |
hello: { | |
type: GraphQLString, | |
description: 'Our first query field, how exciting!', |
type Recursive { | |
id: ID! | |
child: Recursive | |
} | |
type Query { | |
recursive: Recursive! | |
} |
query RecursiveExample { | |
recursive { | |
id | |
child { | |
id | |
child { | |
id | |
} | |
} | |
} |
fragment RecursiveFragment on Recursive { | |
id | |
child { | |
...RecursiveFragment | |
} | |
} |
'use strict'; | |
const express = require('express'); | |
const request = require('request-promise'); | |
const FOAAS_URL = 'http://foaas.com/'; | |
const RANDOM_URL = 'http://api.randomuser.me/'; | |
const logError = console.log.bind( console ); |