Skip to content

Commit

Permalink
Merge pull request #320 from hyper63/twilson63/chg-type-collisions-in…
Browse files Browse the repository at this point in the history
…-app-graphql

Twilson63/chg type collisions in app graphql
  • Loading branch information
twilson63 committed Sep 13, 2021
2 parents a9c34e7 + 97fdd57 commit 9265648
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 157 deletions.
5 changes: 3 additions & 2 deletions images/nano/deps.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export { default as hyper } from "https://x.nest.land/[email protected].7/mod.js";
export { default as hyper } from "https://x.nest.land/[email protected].9/mod.js";
export { default as app } from "https://x.nest.land/[email protected]/mod.js";
//export { default as app } from "../../packages/app-opine/mod.js";

// adapters
export { default as dndb } from "https://x.nest.land/[email protected]/mod.js";
export { default as cache } from "https://x.nest.land/[email protected]/mod.js";
export { default as fs } from "https://x.nest.land/[email protected]/mod.js";
export { default as minisearch } from "https://x.nest.land/[email protected].11/mod.js";
export { default as minisearch } from "https://x.nest.land/[email protected].12/mod.js";
2 changes: 1 addition & 1 deletion packages/app-graphql/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export {
export { makeExecutableSchema } from "https://deno.land/x/[email protected]/schema/makeExecutableSchema.ts";
export { GraphQLHTTP } from "https://deno.land/x/[email protected]/mod.ts";

export { join } from "https://deno.land/std@0.99.0/path/mod.ts";
export { join } from "https://deno.land/std@0.106.0/path/mod.ts";

export * as R from "https://cdn.skypack.dev/ramda@^0.27.1";
export { default as crocks } from "https://cdn.skypack.dev/crocks@^0.12.4";
Expand Down
6 changes: 3 additions & 3 deletions packages/app-graphql/mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import { lookup as getMimeType } from "https://deno.land/x/[email protected]/mod.ts";
import { default as helmet } from "https://cdn.skypack.dev/helmet@^4.6.0";
import { opineCors as cors } from "https://deno.land/x/[email protected]/mod.ts";
import { Buffer } from "https://deno.land/std@0.99.0/io/buffer.ts";
import { MultipartReader } from "https://deno.land/std@0.99.0/mime/mod.ts";
import { exists } from "https://deno.land/std@0.99.0/fs/exists.ts";
import { Buffer } from "https://deno.land/std@0.106.0/io/buffer.ts";
import { MultipartReader } from "https://deno.land/std@0.106.0/mime/mod.ts";
import { exists } from "https://deno.land/std@0.106.0/fs/exists.ts";

import { crocks, opine } from "./deps.js";

Expand Down
14 changes: 14 additions & 0 deletions packages/app-opine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<h1 align="center">⚡️ hyper-app-opine ⚡️</h1>
<p align="center">
hyper is a modular service framework that allows you to plug and play service adapters, `hyper-app-opine` is
an `app` adapter that provides a REST endpoints for interacting with hyper. You can map hyper's ports to any
kind of API front-end, app-opine uses REST. You can find our more about the REST API here: https://doc.hyper.io
</p>
<p align="center">
<a href="https://nest.land/package/hyper-app-opine"><img src="https://nest.land/badge.svg" alt="Nest Badge" /></a>
<a href="https://github.com/hyper63/hyper/actions/workflows/test-app-opine.yml"><img src="https://github.com/hyper63/hyper/actions/workflows/test-app-opine.yml/badge.svg" alt="Test" /></a>
</p>

## For more information

Check out https://docs.hyper.io
9 changes: 4 additions & 5 deletions packages/app-opine/deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ export { json, opine, Router } from "https://deno.land/x/[email protected]/mod.ts";
export { opineCors as cors } from "https://deno.land/x/[email protected]/mod.ts";
export { lookup as getMimeType } from "https://deno.land/x/[email protected]/mod.ts";

export { MultipartReader } from "https://deno.land/std@0.102.0/mime/mod.ts";
export { Buffer } from "https://deno.land/std@0.102.0/io/buffer.ts";
export { exists } from "https://deno.land/std@0.102.0/fs/exists.ts";
export { MultipartReader } from "https://deno.land/std@0.106.0/mime/mod.ts";
export { Buffer } from "https://deno.land/std@0.106.0/io/buffer.ts";
export { exists } from "https://deno.land/std@0.106.0/fs/exists.ts";

export { default as helmet } from "https://cdn.skypack.dev/helmet@^4.6.0";

export * as R from "https://cdn.skypack.dev/ramda@^0.27.1";
export { default as crocks } from "https://cdn.skypack.dev/crocks@^0.12.4";

export { hyperGqlRouter } from "https://x.nest.land/[email protected]/router.js";
//export { hyperGqlRouter } from "https://x.nest.land/[email protected]/router.js";
272 changes: 135 additions & 137 deletions packages/app-opine/deps_lock.json

Large diffs are not rendered by default.

20 changes: 11 additions & 9 deletions packages/app-opine/mod.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
import { hyperGqlRouter, opine } from "./deps.js";
//import { hyperGqlRouter, opine } from "./deps.js";
import { opine } from "./deps.js";

import { hyperRouter } from "./router.js";

// opine app
export default function (services) {
const playground = Deno.env.get("GQL_PLAYGROUND");
//const playground = Deno.env.get("GQL_PLAYGROUND");
const port = Deno.env.get("PORT") ? parseInt(Deno.env.get("PORT")) : 6363;
const env = Deno.env.get("DENO_ENV");

const app = opine();

// REST
app.use(hyperRouter(services));

// GQL
app.use(
"/graphql",
hyperGqlRouter({
playground: (playground && playground !== "false") ||
env !== "production",
})(services),
);
// app.use(
// "/graphql",
// hyperGqlRouter({
// playground: (playground && playground !== "false") ||
// env !== "production",
// })(services),
// );

if (env !== "test") {
app.listen(port);
Expand Down
2 changes: 2 additions & 0 deletions packages/app-opine/test/mod_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ Deno.test("GET /", async () => {
assertEquals(res.body.name, "hyper63");
});

/*
Deno.test("GET /graphql", async () => {
await superdeno(app)
.get("/graphql")
.set("Accept", "text/html") // ask for the playground
.expect(200);
});
*/

0 comments on commit 9265648

Please sign in to comment.