Initial commit

This commit is contained in:
Trevor Blades
2018-10-11 00:06:53 -04:00
commit ce585f546d
5 changed files with 4860 additions and 0 deletions

3
.eslintrc Normal file
View File

@@ -0,0 +1,3 @@
{
"extends": "@trevorblades"
}

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

37
index.js Normal file
View File

@@ -0,0 +1,37 @@
import {ApolloServer, gql} from 'apollo-server';
import {countries} from 'countries-list';
const typeDefs = gql`
type Country {
code: String
name: String
native: String
phone: String
continent: String
currency: String
languages: [String]
emoji: String
emojiU: String
}
type Query {
countries: [Country]
}
`;
const countriesArray = Object.keys(countries).map(code => ({
code,
...countries[code]
}));
const resolvers = {
Query: {
countries: () => countriesArray
}
};
const server = new ApolloServer({typeDefs, resolvers});
server.listen().then(({url}) => {
console.log(`🚀 Server ready at ${url}`);
});

4800
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

19
package.json Normal file
View File

@@ -0,0 +1,19 @@
{
"engines": {
"node": "8"
},
"scripts": {
"pretest": "eslint index.js",
"test": "echo \"Error: no test specified\" && exit",
"start": "nodemon -r esm index.js"
},
"dependencies": {
"@trevorblades/eslint-config": "^6.18.0",
"apollo-server": "^2.1.0",
"countries-list": "^2.3.2",
"eslint": "^5.6.1",
"esm": "^3.0.84",
"graphql": "^14.0.2",
"nodemon": "^1.18.4"
}
}