Skip to content

Commit

Permalink
updated docs to reference apollo-server and updated keywords in package
Browse files Browse the repository at this point in the history
  • Loading branch information
ch-andrewrhyne committed Sep 7, 2017
1 parent 2fe101d commit 9d4d3cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ const UnknownError = createError('UnknownError', {
export const baseResolver = createResolver(
//incoming requests will pass through this resolver like a no-op
null,
/*
Only mask outgoing errors that aren't already apollo-errors,

/*
Only mask outgoing errors that aren't already apollo-errors,
such as ORM errors etc
*/
(root, args, context, error) => isInstance(error) ? error : new UnknownError()
Expand Down Expand Up @@ -79,7 +79,7 @@ export const isAdminResolver = isAuthenticatedResolver.createResolver(
the client within the `errors` array in the response.
*/
if (!user.isAdmin) throw new ForbiddenError();

/*
Since we aren't returning anything from the
request resolver, the request will continue on
Expand Down Expand Up @@ -134,7 +134,7 @@ const banUser = isAdminResolver.createResolver(
For admin users, let's tell the user what actually broke
in the case of an unhandled exception
*/

if (!isInstance(error)) throw new ExposedError({
// overload the message
message: error.message
Expand Down Expand Up @@ -175,7 +175,7 @@ Resolvers are provided a mutable context object that is shared between all resol
``` javascript
import express from 'express';
import bodyParser from 'body-parser';
import { graphqlExpress } from 'graphql-server-express';
import { graphqlExpress } from 'apollo-server-express';
import { createExpressContext } from 'apollo-resolvers';
import { formatError as apolloFormatError, createError } from 'apollo-errors';

Expand Down Expand Up @@ -212,16 +212,16 @@ app.use((req, res, next) => {

app.post('/graphql', graphqlExpress((req, res) => {
const user = req.user;

const models = {
User: new UserModel(user)
};

const context = createExpressContext({
models,
user
}, res);

return {
schema,
formatError, // error formatting via apollo-errors
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"graphql",
"resolvers",
"apollo",
"apollo-client",
"apollo-server",
"api"
],
"author": "Andrew E. Rhyne",
Expand Down

0 comments on commit 9d4d3cd

Please sign in to comment.