@certik/skynet 0.18.2 → 0.18.4-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.18.4
4
+
5
+ - `api`: allow APIs to define its own index handler
6
+
7
+ ## 0.18.3
8
+
9
+ - BREAKING: remove url from graphql.js interface
10
+
3
11
  ## 0.18.2
4
12
 
5
13
  - BREAKING: remove appName from search.js interface
package/api.js CHANGED
@@ -117,11 +117,6 @@ ${getSelectorDesc(selector)}
117
117
 
118
118
  const { verbose, ...selectorFlags } = cli.flags;
119
119
 
120
- // for health check
121
- app.get("/", (req, res) => {
122
- res.send("ok");
123
- });
124
-
125
120
  for (const route of routes) {
126
121
  const method = route.method ? route.method.toLowerCase() : "get";
127
122
  const middlewares = route.middlewares || [];
@@ -156,6 +151,13 @@ ${getSelectorDesc(selector)}
156
151
  }
157
152
  }
158
153
 
154
+ if (!routes.some((r) => r.path === "/" && r.method.toUpperCase() === "GET")) {
155
+ // for health check
156
+ app.get("/", (req, res) => {
157
+ res.send("ok");
158
+ });
159
+ }
160
+
159
161
  if (beforeListen) {
160
162
  await beforeListen({ app });
161
163
  }
package/graphql.js CHANGED
@@ -1,10 +1,8 @@
1
- const GRAPHQL_API_KEY = process.env.SKYNET_GRAPHQL_API_KEY || process.env.GRAPHQL_API_KEY;
2
-
3
- export async function gql(url, query, variables = {}) {
4
- const res = await fetch(url, {
1
+ export async function gql(query, variables = {}) {
2
+ const res = await fetch(process.env.SKYNET_GRAPHQL_ENDPOINT, {
5
3
  method: "POST",
6
4
  headers: {
7
- "x-api-key": GRAPHQL_API_KEY,
5
+ "x-api-key": process.env.SKYNET_GRAPHQL_API_KEY,
8
6
  "content-type": "application/json",
9
7
  },
10
8
  body: JSON.stringify({ query: query.trim(), variables }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certik/skynet",
3
- "version": "0.18.2",
3
+ "version": "0.18.4-beta",
4
4
  "description": "Skynet Shared JS library",
5
5
  "type": "module",
6
6
  "main": "index.js",