Skip to content

Commit 2ae34fa

Browse files
committed
fix backend: made swagger.json viewable in browser, updated nginx.conf
1 parent a06b393 commit 2ae34fa

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

backend/server.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import swaggerUi from "swagger-ui-express";
33
import swaggerDocument from "./build/swagger.json";
44
import { RegisterRoutes } from "./build/routes.ts";
55
import express from "express";
6+
import * as path from "node:path";
67

78
const app = express();
89

910
app.use(express.json());
1011
app.use(cors({ origin: "*" }));
1112

1213
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(swaggerDocument));
13-
app.get("/api-spec", (req, res) => res.download("./build/swagger.json"));
14+
app.get("/api-spec", (req, res) => res.sendFile(path.join(__dirname, "build", "swagger.json")));
1415
app.get("/api", (req, res) => res.redirect("/api-docs"));
1516

1617
RegisterRoutes(app);

nginx/nginx.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ server {
2020
ssl_prefer_server_ciphers on;
2121

2222
# Backend base URL
23-
location /api/ {
23+
location ~ ^/api {
2424
proxy_pass http://navigator-backend:8000; # container_name of the backend
2525
proxy_http_version 1.1;
2626

0 commit comments

Comments
 (0)