Miss any of our Open RFC calls?Watch the recordings here! »

graphql-url

2.0.5 • Public • Published

graphql-url

graphql scalar validating that it's a correct url

Installation

yarn install graphql-url [--dev]

Usage

This module exports 3 different scalars - one for absolute urls (GraphQLAbsoluteUrl), one for relative urls (GraphQLRelativeUrl) and one for either relative or absolute urls (GraphQLUrl);

import { GraphQLUrl } from 'graphql-url';
 
const schema = new GraphQLSchema({
  query: new GraphQLObjectType({
    name: 'RootQueryType',
    fields: {
      foo: {
        type: GraphQLUrl,
        resolve() {
          return 'https://foo.com/bar';
        }
      }
    }
  })
});

Keywords

Install

npm i graphql-url

DownloadsWeekly Downloads

199

Version

2.0.5

License

MIT

Unpacked Size

20.3 kB

Total Files

10

Last publish

Collaborators

  • avatar
  • avatar
  • avatar