altair-fastify-plugin
Advanced tools
Comparing version 1.4.11 to 2.4.10
/// <reference types="node" /> | ||
import { RenderOptions } from "altair-static"; | ||
import type { FastifyPluginCallback } from "fastify"; | ||
import { RenderOptions } from 'altair-static'; | ||
import type { FastifyPluginCallback } from 'fastify'; | ||
export interface AltairFastifyPluginOptions extends RenderOptions { | ||
@@ -5,0 +5,0 @@ /** |
@@ -11,9 +11,9 @@ "use strict"; | ||
if (renderOptions.baseURL == null) { | ||
renderOptions.baseURL = "/altair/"; | ||
renderOptions.baseURL = '/altair/'; | ||
} | ||
if (renderOptions.endpointURL == null) { | ||
renderOptions.endpointURL = "/graphql"; | ||
renderOptions.endpointURL = '/graphql'; | ||
} | ||
if (path == null) { | ||
path = "/altair"; | ||
path = '/altair'; | ||
} | ||
@@ -26,3 +26,3 @@ fastify.register(fastify_static_1.default, { | ||
fastify.get(path, (_req, res) => { | ||
res.type("text/html").send(altairPage); | ||
res.type('text/html').send(altairPage); | ||
}); | ||
@@ -32,4 +32,4 @@ done(); | ||
exports.default = fastify_plugin_1.default(fastifyAltairPlugin, { | ||
fastify: ">= 3.x", | ||
name: "altair-fastify-plugin", | ||
fastify: '>= 3.x', | ||
name: 'altair-fastify-plugin', | ||
}); |
{ | ||
"name": "altair-fastify-plugin", | ||
"version": "1.4.11", | ||
"version": "2.4.10", | ||
"description": "Fastify Plugin of Altair GraphQL Client", | ||
@@ -12,9 +12,9 @@ "keywords": [ | ||
], | ||
"homepage": "https://imolorhe.github.io/altair/tree/master/packages/altair-fastify-plugin#readme", | ||
"homepage": "https://github.com/imolorhe/altair#readme", | ||
"bugs": { | ||
"url": "https://github.com/PabloSzx/altair/issues" | ||
"url": "https://github.com/imolorhe/altair/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/PabloSzx/altair.git" | ||
"url": "git+https://github.com/imolorhe/altair.git" | ||
}, | ||
@@ -26,5 +26,7 @@ "license": "MIT", | ||
"files": [ | ||
"dist" | ||
"dist", | ||
"example" | ||
], | ||
"scripts": { | ||
"example": "ts-node example/fastifyGQL.ts", | ||
"prepublish": "tsc" | ||
@@ -40,2 +42,3 @@ }, | ||
"fastify-gql": "^5.1.1", | ||
"ts-node": "^8.10.2", | ||
"typescript": "^3.9.7" | ||
@@ -42,0 +45,0 @@ }, |
@@ -1,11 +0,40 @@ | ||
# `altair-fastify-plugin` | ||
# altair-fastify-plugin | ||
> TODO: description | ||
[](https://www.npmjs.com/package/altair-fastify-plugin) | ||
## Usage | ||
This is a [**Fastify Plugin**](https://www.fastify.io/docs/master/Plugins/) for hosting an instance of **Altair GraphQL Client**, with support for **TypeScript**, and tested for **Fastify v3**. | ||
## Install | ||
```sh | ||
npm install altair-fastify-plugin | ||
# or | ||
yarn add altair-fastify-plugin | ||
``` | ||
const altairFastifyPlugin = require('altair-fastify-plugin'); | ||
// TODO: DEMONSTRATE API | ||
## Usage | ||
```js | ||
// const Fastify = require("fastify"); | ||
import Fastify from 'fastify'; | ||
// const AltairFastify = require("altair-fastify-plugin"); | ||
import AltairFastify from 'altair-fastify-plugin'; | ||
const app = Fastify(); | ||
// ... | ||
app.register(AltairFastify, { | ||
/** | ||
* All these are the defaults. | ||
*/ | ||
path: '/altair', | ||
baseUrl: '/altair/', | ||
endpointURL: '/graphql', | ||
}); | ||
// ... | ||
// Altair available at localhost:3000/altair | ||
app.listen(3000); | ||
``` |
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
5580
6
143
0
41
4