This repository has been archived by the owner on Oct 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from gursesl/PR-apollo
Pr apollo
- Loading branch information
Showing
39 changed files
with
8,313 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
{ | ||
"presets": ["env", "react", "stage-2"] | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"node": "current" | ||
} | ||
}], "react", "stage-2"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,3 +62,6 @@ src/utils/db.json | |
package-lock.json | ||
|
||
dist | ||
|
||
# Webstorm files | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,29 @@ | ||
/* eslint-disable no-console */ | ||
import webpack from 'webpack'; | ||
import chalk from 'chalk'; | ||
import webpackConfig from '../webpack.config.prod'; | ||
import webpack from 'webpack' | ||
import chalk from 'chalk' | ||
import webpackConfig from '../webpack.config.prod' | ||
|
||
// process.env.NODE_ENV = 'production'; | ||
// process.env.NODE_ENV = 'production' | ||
|
||
console.log(chalk.blue('Generating minified bundle for production. This will take a moment...')); | ||
console.log(chalk.blue('Generating minified bundle for production. This will take a moment...')) | ||
|
||
webpack(webpackConfig).run((err, stats) => { | ||
if (err) { // fatal error, stop here | ||
console.log(chalk.red(err)); | ||
return 1; | ||
console.log(chalk.red(err)) | ||
return 1 | ||
} | ||
|
||
const jsonStats = stats.toJson(); | ||
const jsonStats = stats.toJson() | ||
|
||
if (jsonStats.hasErrors) { | ||
return jsonStats.errors.map(error => console.log(chalk.red(error))); | ||
return jsonStats.errors.map(error => console.log(chalk.red(error))) | ||
} | ||
|
||
if (jsonStats.hasWarnings) { | ||
console.log(chalk.yellow('Webpack generated the following warnings:')); | ||
jsonStats.warnings.map(warning => console.log(chalk.yellow(warning))); | ||
console.log(chalk.yellow('Webpack generated the following warnings:')) | ||
jsonStats.warnings.map(warning => console.log(chalk.yellow(warning))) | ||
} | ||
|
||
console.log(`Webpack stats: ${stats}`); | ||
|
||
console.log(chalk.green('App has been built for production and written to /dist')); | ||
|
||
return 0; | ||
}); | ||
console.log(`Webpack stats: ${stats}`) | ||
console.log(chalk.green('App has been built for production and written to /dist')) | ||
return 0 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Login modal component | ||
|
||
## Task list | ||
- [x] Design login modal container/component - Semantic UI https://react.semantic-ui.com/modules/modal#modal-example-dimmer | ||
![alt text](./images/login-modal-mockup.jpg "Login component mockup") | ||
- [x] Apollo server | ||
- [x] Apollo mock data server | ||
- [x] Apollo client | ||
- [ ] Refactor client/server folder structure | ||
- [ ] Test Apollo server | ||
- [ ] Test Apollo client | ||
- [ ] Solidify central api calling script | ||
- [ ] MongoDB | ||
- [ ] Local setup | ||
- [ ] mLabs setup, env key for Heroku | ||
- [ ] Test login modal | ||
- [ ] Login modal | ||
- [ ] Test logout modal | ||
- [ ] Logout modal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"presets": [ | ||
"env", | ||
"stage-0" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "gqlserver", | ||
"version": "1.0.0", | ||
"description": "GraphQL Server for Cherry Pie", | ||
"main": "server.js", | ||
"scripts": { | ||
"start": "nodemon ./server.js --exec babel-node -e js", | ||
"test": "jest" | ||
}, | ||
"author": "Levent Gurses", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-stage-0": "^6.24.1", | ||
"nodemon": "^1.12.1" | ||
}, | ||
"dependencies": { | ||
"apollo-server-express": "^1.1.7", | ||
"body-parser": "^1.18.2", | ||
"chalk": "^2.2.0", | ||
"cors": "^2.8.4", | ||
"express": "^4.16.2", | ||
"graphql": "^0.11.7", | ||
"graphql-tools": "^2.5.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import express from 'express' | ||
import bodyParser from 'body-parser' | ||
import cors from 'cors' | ||
import chalk from 'chalk' | ||
import { graphqlExpress, graphiqlExpress } from 'apollo-server-express' | ||
import { schema } from './src/schema' | ||
|
||
const PORT = process.env.GRAPHQL_PORT || 4000 | ||
const server = express() | ||
server.use('*', cors({ origin: '*' })) | ||
|
||
server.use('/graphql', bodyParser.json(), graphqlExpress({ schema })) | ||
server.use('/graphiql', bodyParser.json(), graphiqlExpress({ endpointURL: '/graphql' })) | ||
|
||
server.listen(PORT, () => { | ||
console.log(chalk.green(`GraphQL server is running on port ${PORT}`)) // eslint-disable-line no-console | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
export const users = [ | ||
{ | ||
id: '1', | ||
userName: 'weraa', | ||
password: 'passw0rd', | ||
email: 'wer@email.com', | ||
firstName: 'Wera', | ||
lastName: 'Andersen', | ||
address: '123 Maple St.', | ||
address2: 'Unit 320', | ||
city: 'Maperville', | ||
state: 'IL', | ||
zip: '22902', | ||
userType: 'caregiver', | ||
}, | ||
{ | ||
id: '2', | ||
userName: 'weraa2', | ||
password: 'passw0rd', | ||
email: 'weraa@email.com', | ||
firstName: 'Smith', | ||
lastName: 'Johnson', | ||
address: '123 Maple St.', | ||
address2: 'Unit 320', | ||
city: 'Maperville', | ||
state: 'IL', | ||
zip: '22902', | ||
userType: 'caregiver', | ||
}, | ||
{ | ||
id: '3', | ||
userName: 'angel23', | ||
password: 'passw0rd', | ||
email: 'weraa@email.com', | ||
firstName: 'Angle', | ||
lastName: 'Lamar', | ||
address: '123 Maple St.', | ||
address2: 'Unit 320', | ||
city: 'Maperville', | ||
state: 'IL', | ||
zip: '22902', | ||
userType: 'caregiver', | ||
}, | ||
{ | ||
id: '4', | ||
userName: 'wera44', | ||
password: 'passw0rd', | ||
email: 'weraa@email.com', | ||
firstName: 'Wera', | ||
lastName: 'Jeromski', | ||
address: '123 Maple St.', | ||
address2: 'Unit 320', | ||
city: 'Maperville', | ||
state: 'IL', | ||
zip: '22902', | ||
userType: 'caregiver', | ||
}, | ||
] | ||
|
||
const resolvers = { | ||
Query: { | ||
users: () => users, | ||
}, | ||
} | ||
|
||
export default resolvers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools' | ||
import resolvers from './resolvers' | ||
|
||
const typeDefs = ` | ||
type User { | ||
id: ID! | ||
userName: String! | ||
password: String! | ||
email: String! | ||
firstName: String | ||
lastName: String | ||
address: String | ||
address2: String | ||
city: String | ||
state: String | ||
zip: String | ||
userType: String! | ||
} | ||
type Query { | ||
users: [User] | ||
} | ||
` | ||
|
||
const schema = makeExecutableSchema({ typeDefs, resolvers }) | ||
// // addMockFunctionsToSchema({ schema }) | ||
|
||
export { schema, typeDefs } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import resolvers, { users } from '../resolvers' | ||
|
||
describe('Resolvers', () => { | ||
it('should return data', () => { | ||
expect(resolvers.Query.users().length).toBe(4) | ||
}) | ||
|
||
it('should behave...', () => { | ||
expect(users.length).toBe(4) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.