Skip to content

Commit 71f3507

Browse files
authored
chore: remove graphql dependencies (#64)
1 parent fb878a0 commit 71f3507

22 files changed

+27
-68724
lines changed

apps/blog-bff/.dev.vars.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
GRAPHQL_URI=
2-
GRAPHQL_TOKEN=
31
WP_REST_API_TOKEN=
42
WP_REST_API_BASE_URL=

apps/blog-bff/src/main.ts

Lines changed: 3 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
11
import { Hono } from 'hono';
22
import { cors } from 'hono/cors';
33
import { cache } from 'hono/cache';
4-
import {
5-
ApolloClient,
6-
InMemoryCache,
7-
NormalizedCacheObject,
8-
} from '@apollo/client/core';
9-
import {
10-
GetPostBySlug,
11-
GetPosts,
12-
LanguageCodeFilterEnum,
13-
} from '@angular-love/wp/graphql/data-access';
14-
import { toArticle, toArticlePreviewList } from './mappers';
154
import { articles } from '@angular-love/blog-bff/articles/api';
165
import { HTTPException } from 'hono/http-exception';
176
import { authors } from '@angular-love/blog-bff/authors/api';
187

19-
type Bindings = {
20-
GRAPHQL_URI: string;
21-
GRAPHQL_TOKEN: string;
22-
};
23-
24-
type Variables = {
25-
apolloClient: ApolloClient<NormalizedCacheObject>;
26-
};
27-
28-
const app = new Hono<{ Bindings: Bindings; Variables: Variables }>();
8+
const app = new Hono();
299

3010
app.use('*', cors());
3111

@@ -38,56 +18,8 @@ app.use(
3818
}),
3919
);
4020

41-
app.use('*', async (c, next) => {
42-
const client = new ApolloClient({
43-
uri: c.env.GRAPHQL_URI,
44-
cache: new InMemoryCache({
45-
addTypename: false,
46-
}),
47-
headers: {
48-
authorization: c.env.GRAPHQL_TOKEN,
49-
},
50-
ssrMode: true,
51-
});
52-
53-
c.set('apolloClient', client);
54-
55-
await next();
56-
});
57-
58-
/**
59-
* @deprecated
60-
*/
61-
app.get('/articles', async (c) => {
62-
const result = await c.var.apolloClient.query({
63-
query: GetPosts,
64-
variables: {
65-
languages: LanguageCodeFilterEnum.En,
66-
first: 10,
67-
},
68-
});
69-
70-
return c.json(toArticlePreviewList(result));
71-
});
72-
73-
/**
74-
* @deprecated
75-
*/
76-
app.get('/articles/:slug', async (c) => {
77-
const slug = c.req.param('slug');
78-
79-
const result = await c.var.apolloClient.query({
80-
query: GetPostBySlug,
81-
variables: {
82-
slug,
83-
},
84-
});
85-
86-
return c.json(toArticle(result));
87-
});
88-
89-
app.route('/v2/articles', articles);
90-
app.route('/v2/authors', authors);
21+
app.route('/articles', articles);
22+
app.route('/authors', authors);
9123

9224
app.onError((err, c) => {
9325
if (err instanceof HTTPException) {

apps/blog-bff/src/mappers.ts

Lines changed: 0 additions & 79 deletions
This file was deleted.

apps/blog/project.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@
7070
"buildTarget": "blog:build:development"
7171
}
7272
},
73-
"options": {
74-
"proxyConfig": "apps/blog/proxy.conf.json"
75-
},
7673
"defaultConfiguration": "development"
7774
},
7875
"extract-i18n": {

apps/blog/proxy.conf.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

libs/wp/graphql/data-access/.eslintrc.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

libs/wp/graphql/data-access/README.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

libs/wp/graphql/data-access/codegen.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

libs/wp/graphql/data-access/graphql.config.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

libs/wp/graphql/data-access/jest.config.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

libs/wp/graphql/data-access/project.json

Lines changed: 0 additions & 31 deletions
This file was deleted.

libs/wp/graphql/data-access/src/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)