Skip to content

Commit 0cc1a59

Browse files
committed
Add ads.txt
1 parent e8a5c69 commit 0cc1a59

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/index.server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ app.use(
1717
);
1818

1919
const proxyMiddleware = proxy('localhost', { port: 5000 });
20+
2021
app.use(router.routes()).use(router.allowedMethods());
2122

2223
app.use(ssrMiddleware);
2324
app.use(proxyMiddleware);
25+
router.get('/ads.txt', (ctx) => {
26+
ctx.body = 'google.com, pub-5574866530496701, DIRECT, f08c47fec0942fa0';
27+
});
2428
// router.post('/graphql', proxyMiddleware);
2529

2630
app.listen(3001, () => {

src/serverless.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ export const handler = async (event: APIGatewayEvent) => {
1111
const loggedIn =
1212
cookie.includes('refresh_token') || cookie.includes('access_token');
1313

14+
if (event.path === 'ads.txt') {
15+
return 'google.com, pub-5574866530496701, DIRECT, f08c47fec0942fa0';
16+
}
17+
1418
try {
1519
const result = await serverRender({
1620
url,

0 commit comments

Comments
 (0)