Skip to content

Commit

Permalink
#3 cors
Browse files Browse the repository at this point in the history
  • Loading branch information
bennobuilder committed Aug 28, 2024
1 parent d71fc3d commit 9ca811b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/api-shopify/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# `@dyn/api-core`
# `@dyn/api-shopify`
7 changes: 6 additions & 1 deletion packages/api-shopify/src/app/router.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { type shopifyApiV1 } from '@repo/types/api';
import { Hono } from 'hono';
import { bearerAuth } from 'hono/bearer-auth';
import { cors } from 'hono/cors';
import { createHonoOpenApiRouter } from '@blgc/openapi-router';

import { appConfig } from '../environment';

export const router = new Hono();

router.use('/session/*', bearerAuth({ token: appConfig.shopifyBearerToken }));
router.use(
'/session/*',
bearerAuth({ token: appConfig.shopifyBearerToken }),
cors({ origin: ['https://shopify.com/', 'https://admin.shopify.com/'] })
);

export const openApiRouter = createHonoOpenApiRouter<shopifyApiV1.paths>(router);
4 changes: 0 additions & 4 deletions packages/api-shopify/vitest.config.js

This file was deleted.

4 changes: 4 additions & 0 deletions packages/api-shopify/vitest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { defineConfig, mergeConfig } from 'vitest/config';
import { nodeConfig } from '@blgc/config/vite/node.config';

export default mergeConfig(nodeConfig, defineConfig({}));

0 comments on commit 9ca811b

Please sign in to comment.