Skip to content

Commit

Permalink
Add allowed origins for API
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed May 18, 2024
1 parent 18c59ff commit 73f4839
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { Hono } from "hono";
import { handle } from "hono/aws-lambda";
import { compress } from "hono/compress";
import { cors } from "hono/cors";
import { showRoutes } from "hono/dev";
import { prettyJSON } from "hono/pretty-json";
import { logger } from "hono/logger";
import { prettyJSON } from "hono/pretty-json";
import { WithId } from "mongodb";
import db from "./config/db";
import { getCarsByFuelType, getCOEResultByMonth } from "./lib";
import { Car, COEResult, FUEL_TYPE } from "./types";

const app = new Hono();

app.use(cors());
app.use(logger());
app.use(compress());
app.use(prettyJSON());
Expand Down
1 change: 1 addition & 0 deletions sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default $config({
handler: "src/index.handler",
url: {
cors: {
allowOrigins: [`https://${DOMAIN_NAME}`],
maxAge: "1 day",
},
},
Expand Down

0 comments on commit 73f4839

Please sign in to comment.