Repository metrics
- Stars
- (95 stars)
- PR merge metrics
- (PR metrics pending)
Description
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.