Skip to content

Commit 5b59049

Browse files
committed
remove cors
1 parent f375437 commit 5b59049

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

api.Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Build stage
21
FROM oven/bun:1.3.2-slim AS builder
32

43
WORKDIR /app
@@ -21,7 +20,6 @@ COPY --from=builder /app/node_modules ./node_modules
2120
COPY --from=builder /app/apps/api ./apps/api
2221
COPY --from=builder /app/packages ./packages
2322

24-
2523
EXPOSE 4000
2624

2725
WORKDIR /app/apps/api

apps/basket/src/index.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,32 +65,19 @@ const app = new Elysia()
6565
span: null as ReturnType<typeof startRequestSpan> | null,
6666
startTime: 0,
6767
})
68-
.onBeforeHandle(function handleCors({ request, set }) {
69-
const origin = request.headers.get("origin");
70-
if (origin) {
71-
set.headers ??= {};
72-
set.headers["Access-Control-Allow-Origin"] = origin;
73-
set.headers["Access-Control-Allow-Methods"] =
74-
"POST, GET, OPTIONS, PUT, DELETE";
75-
set.headers["Access-Control-Allow-Headers"] =
76-
"Content-Type, Authorization, X-Requested-With, databuddy-client-id, databuddy-sdk-name, databuddy-sdk-version";
77-
set.headers["Access-Control-Allow-Credentials"] = "true";
78-
}
79-
})
8068
.onBeforeHandle(function startTrace({ request, path, store }) {
8169
const method = request.method;
8270
const startTime = Date.now();
8371
const span = startRequestSpan(method, request.url, path);
8472

85-
// Store span and start time in Elysia store
8673
store.tracing = {
8774
span,
8875
startTime,
8976
};
9077
})
91-
.onAfterHandle(function endTrace({ response, store }) {
78+
.onAfterHandle(function endTrace({ responseValue, store }) {
9279
if (store.tracing?.span && store.tracing.startTime) {
93-
const statusCode = response instanceof Response ? response.status : 200;
80+
const statusCode = responseValue instanceof Response ? responseValue.status : 200;
9481
endRequestSpan(store.tracing.span, statusCode, store.tracing.startTime);
9582
}
9683
})

0 commit comments

Comments
 (0)