Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Add option to specify base uris #114

Open
n1ru4l opened this issue May 14, 2018 · 0 comments
Open

Add option to specify base uris #114

n1ru4l opened this issue May 14, 2018 · 0 comments

Comments

@n1ru4l
Copy link
Owner

n1ru4l commented May 14, 2018

Instead of supplying the schema string with lots of urls strings (that are mostly the same) it should be possible to shorten them. Also in case of a refactor there would be less code to change.

Idea:

new (object literal/string) option for function generateRestSchema: baseUri.

Case 1: baseUriis a string

import { generateRestSchema } from '@n1ru4l/graphql-schema-generator-rest'

generateRestSchema({ baseUri: `https://localhost:8080` })

Every route directive option that does not start with a scheme (e.g. https://, http:// is prefixed with the baseUri

Case 2: baseUri is a object literal:

import { generateRestSchema } from '@n1ru4l/graphql-schema-generator-rest'

generateRestSchema({ baseUri: {
  dogs: `https://localhost:8080`,
  cats: `https://localhost:8081`
} })

Every route directive option that does not start with a scheme (e.g. https://, http://) but has a uri directive option which matches a key of the baseUri option object is prefixed with the corresponding value.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant