# foxer360-authorization

> Authorization graphql middleware

Latest version **1.0.5** (published 2019-01-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install foxer360-authorization
pnpm add foxer360-authorization
yarn add foxer360-authorization
bun add foxer360-authorization
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2019-01-07 |
| First published | 2018-12-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Michal Kudrnac |
| Maintainers | michalkud |
| Keywords | authorization, graphql, token |

## Links

- npm: https://www.npmjs.com/package/foxer360-authorization
- npm.io page: https://npm.io/package/foxer360-authorization

## Dependencies (2)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.2.0
- [graphql-request](https://npm.io/package/graphql-request.md) ^1.8.2

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2019-01-07
- 1.0.4 — 2019-01-07
- 1.0.3 — 2018-12-27
- 1.0.2 — 2018-12-21
- 1.0.1 — 2018-12-21
- 1.0.0 — 2018-12-21

## README

# authorization-middleware

## Instalation

```bash 
npm install foxer360-authorization --save

```

## Standalone usage

```ts
import { applyMiddleware } from 'graphql-middleware'
import { makeExecutableSchema } from 'graphql-tools'
import authorizationMiddleware from 'foxer360-authorization'

const typeDefs = `
  type Query {
    hello(name: String): String
  }
`
const resolvers = {
  Query: {
    hello: (parent, { name }, context) => `Hello ${name ? name : 'world'}!`,
  },
}

const schema = makeExecutableSchema({ typeDefs, resolvers })

const schemaWithMiddleware = applyMiddleware(
  schema,
  authorizationMiddleware('http://localhost:4001') // authorization api address
)
```

### Usage with `graphql-yoga`

> `graphql-yoga` has built-in support for `graphql-middleware`!

```ts
import { GraphQLServer } from 'graphql-yoga'
import authorizationMiddleware from 'foxer360-authorization';

const typeDefs = `
  type Query {
    hello(name: String): String
  }
`
const resolvers = {
  Query: {
    hello: (parent, { name }, context) => `Hello ${name ? name : 'world'}!`,
  },
}

const server = new GraphQLServer({
  typeDefs,
  resolvers,
  middlewares: [
    authorizationMiddleware('http://localhost:4001') // authorization api address
  ],
  documentMiddleware: [],
})
server.start(() => console.log('Server is running on localhost:4000'))
```

---
_Source: https://npm.io/package/foxer360-authorization · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
