Skip to content

Commit

Permalink
updated complete project file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
dhyeythumar committed Jan 17, 2022
1 parent 2fd1ad6 commit 3be5ebc
Show file tree
Hide file tree
Showing 27 changed files with 135 additions and 114 deletions.
7 changes: 4 additions & 3 deletions app.arc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ graphql-proxy-api
@aws
runtime nodejs14.x

@shared
src src/shared

@http
/*
method any
src /src/graphql
any /*
30 changes: 8 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"name": "graphql-proxy-api",
"version": "1.0.0",
"version": "1.1.0",
"description": "GraphQL Proxy API for testing and prototyping.",
"author": "Dhyey Thumar",
"email": "dhyeythumar@gmail.com",
"license": "MIT",
"main": "api/graphql.js",
"main": "src/http/any-catchall/index.js",
"type": "module",
"engines": {
"node": ">=14"
},
"scripts": {
"start": "npx sandbox",
"test": "echo 'Test not working on Begin.com'",
"test:dev": "tape tests/*.test.js | tap-spec"
"test": "tape tests/*.test.js | tap-spec"
},
"repository": {
"type": "git",
Expand All @@ -26,13 +28,10 @@
"url": "https://github.com/dhyeythumar/graphql-proxy-api/issues"
},
"homepage": "https://github.com/dhyeythumar/graphql-proxy-api#readme",
"dependencies": {
"axios": "^0.21.4"
},
"devDependencies": {
"@architect/sandbox": "^4.5.2",
"tap-spec": "^5.0.0",
"tape": "^5.4.1",
"tiny-json-http": "^7.3.1"
}
}
}
33 changes: 3 additions & 30 deletions src/graphql/index.js → src/http/any-catchall/index.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,18 @@
import arc from "@architect/functions";
import { promisify } from "util";
import path, { resolve } from "path";
import path from "path";
import fs from "fs";
import { ApolloServer } from "apollo-server-lambda";
import {
ApolloServerPluginLandingPageProductionDefault,
ApolloServerPluginLandingPageLocalDefault,
} from "apollo-server-core";
import resolvers from "@architect/shared/resolvers/index.js";

const __dirname = path.resolve();

const readdir = promisify(fs.readdir);
async function* getFiles(dir) {
const dirents = await readdir(dir, { withFileTypes: true });
for (const dirent of dirents) {
const res = resolve(dir, dirent.name);
if (dirent.isDirectory()) {
yield* getFiles(res);
} else {
yield res;
}
}
}

(async () => {
try {
for await (const f of getFiles("../../var")) {
console.log(f);
}
} catch (err) {
console.error(err);
}
})();

console.info("__dirname", __dirname);

import resolvers from "../resolvers/index.js";

const ServerHandler = new ApolloServer({
typeDefs: fs.readFileSync(
path.join(__dirname, "../", "schema.graphql"),
path.join(__dirname, "./", "schema.graphql"),
"utf8"
),
resolvers,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"type": "module",
"dependencies": {
"@architect/functions": "latest",
"apollo-server-core": "^3.3.0",
"apollo-server-lambda": "^3.6.1",
"graphql": "^15.5.3"
"graphql": "^15.5.3",
"@architect/functions": "^4.1.1"
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lib/AlbumModule.js → src/shared/lib/AlbumModule.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsonPlaceholder } from "../utils/base-axios.js";
import { jsonPlaceholder } from "../utils.js";

export default class AlbumModule {
//* create an Album
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsonPlaceholder } from "../utils/base-axios.js";
import { jsonPlaceholder } from "../utils.js";

export default class CommentModule {
//* create a Comment
Expand Down
2 changes: 1 addition & 1 deletion src/lib/PhotoModule.js → src/shared/lib/PhotoModule.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsonPlaceholder } from "../utils/base-axios.js";
import { jsonPlaceholder } from "../utils.js";

export default class PhotoModule {
//* create a Photo
Expand Down
2 changes: 1 addition & 1 deletion src/lib/PostModule.js → src/shared/lib/PostModule.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsonPlaceholder } from "../utils/base-axios.js";
import { jsonPlaceholder } from "../utils.js";

export default class PostModule {
//* create a Post
Expand Down
2 changes: 1 addition & 1 deletion src/lib/TodoModule.js → src/shared/lib/TodoModule.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsonPlaceholder } from "../utils/base-axios.js";
import { jsonPlaceholder } from "../utils.js";

export default class TodoModule {
//* create a Todo
Expand Down
2 changes: 1 addition & 1 deletion src/lib/UserModule.js → src/shared/lib/UserModule.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsonPlaceholder } from "../utils/base-axios.js";
import { jsonPlaceholder } from "../utils.js";

export default class UserModule {
//* create a User
Expand Down
Loading

0 comments on commit 3be5ebc

Please sign in to comment.