Merge pull request #12 from trevorblades/heroku

Move service back to Heroku
This commit is contained in:
Trevor Blades
2020-02-27 11:02:53 -08:00
committed by GitHub
9 changed files with 1038 additions and 288 deletions

2
.gitignore vendored
View File

@@ -1,2 +1,2 @@
node_modules
.netlify
.env

1
Procfile Normal file
View File

@@ -0,0 +1 @@
web: node index.js

View File

@@ -3,13 +3,13 @@
# Countries GraphQL API
[![Build Status](https://github.com/trevorblades/countries/workflows/Node%20CI/badge.svg)](https://github.com/trevorblades/countries/actions)
[![Netlify Status](https://api.netlify.com/api/v1/badges/3c699c2c-545e-47f2-891e-efbc01841b64/deploy-status)](https://app.netlify.com/sites/wonderful-bartik-c66edf/deploys)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
A public GraphQL API for information about countries, continents, and languages. This project uses [Countries List](https://annexare.github.io/Countries/) as a data source, so the schema follows the shape of that data, with a few exceptions:
A public GraphQL API for information about countries, continents, and languages. This project uses [Countries List](https://annexare.github.io/Countries/) and [`provinces`](https://github.com/substack/provinces) as data sources, so the schema follows the shape of that data, with a few exceptions:
1. The codes used to key the objects in the original data are available as a `code` property on each item returned from the API.
2. The `continent` and `languages` properties are now objects and arrays of objects, respectively.
3. Each `Country` has an array of `states` populated by their states/provinces, if any.
## Writing queries
@@ -62,5 +62,3 @@ Check out [the playground](https://countries.trevorblades.com) to explore the sc
## License
[MIT](./LICENSE)
[![Deploys by Netlify](https://www.netlify.com/img/global/badges/netlify-color-accent.svg)](https://www.netlify.com)

View File

@@ -1 +0,0 @@
/ /.netlify/functions/graphql 200!

View File

View File

@@ -1,5 +1,5 @@
const provinces = require('provinces');
const {ApolloServer, gql} = require('apollo-server-lambda');
const {ApolloServer, gql} = require('apollo-server');
const {continents, countries, languages} = require('countries-list');
const typeDefs = gql`
@@ -136,8 +136,6 @@ const server = new ApolloServer({
}
});
exports.handler = server.createHandler({
cors: {
origin: '*'
}
server.listen({port: process.env.PORT}).then(({url}) => {
console.log(`🚀 Server ready at ${url}`);
});

View File

@@ -1,3 +0,0 @@
[build]
command = "noop"
functions = "functions"

1297
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,14 @@
{
"scripts": {
"pretest": "eslint functions",
"start": "nodemon -r dotenv/config index.js",
"pretest": "eslint index.js apollo.config.js",
"test": "echo \"Error: no test specified\" && exit"
},
"eslintConfig": {
"extends": "@trevorblades"
},
"dependencies": {
"apollo-server-lambda": "^2.10.0",
"apollo-server": "^2.10.1",
"countries-list": "^2.4.3",
"graphql": "^14.6.0",
"provinces": "^1.11.0"
@@ -15,7 +16,8 @@
"devDependencies": {
"@trevorblades/eslint-config": "^7.0.1",
"apollo": "^2.16.0",
"dotenv": "^8.2.0",
"eslint": "^6.2.1",
"noop-cli": "^1.0.0"
"nodemon": "^2.0.2"
}
}