Skip to content

Commit

Permalink
fired up some apollo for a PoC
Browse files Browse the repository at this point in the history
  • Loading branch information
snurby7 committed Jan 15, 2019
1 parent 1897ef4 commit e6388dd
Show file tree
Hide file tree
Showing 7 changed files with 551 additions and 21 deletions.
14 changes: 5 additions & 9 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
"browser": true,
"jest/globals": true
},
"extends": [
"airbnb",
"plugin:prettier/recommended"
],
"extends": ["airbnb", "plugin:prettier/recommended"],
"rules": {
"strict": 0
"strict": 0,
"linebreak-style": 0
},
"plugins": [
"jest"
]
}
"plugins": ["jest"]
}
3 changes: 3 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esversion": 6
}
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo

[Yarn](https://yarnpkg.com/en/)

## Backend/API

[Apollo](https://www.apollographql.com)
[Apollo CLI](https://github.com/apollographql/apollo-tooling)

## Database/Storage

Open to a suggestion otherwise Mongo DB Atlas

## Available Scripts

In the project directory, you can run:
Expand Down
25 changes: 25 additions & 0 deletions backend/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const { ApolloServer, gql } = require('apollo-server');

// The GraphQL schema
const typeDefs = gql`
type Query {
"A simple type for getting started!"
hello: String
}
`;

// A map of functions which return data for the schema.
const resolvers = {
Query: {
hello: () => 'world',
},
};

const server = new ApolloServer({
typeDefs,
resolvers,
});

server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"apollo-server": "^2.3.1",
"graphql": "^14.0.2",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-scripts": "2.1.3"
},
"scripts": {
"start": "react-scripts start",
"start-apollo": "cd backend/ && node index.js",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "es6",
"lib": [
"dom",
"dom.iterable",
Expand Down
Loading

0 comments on commit e6388dd

Please sign in to comment.