Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions end2end/server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
13 changes: 7 additions & 6 deletions end2end/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM node:22-slim
FROM node:24-slim

USER node
WORKDIR /app

COPY package.json /app
COPY --chown=node:node package.json package-lock.json ./
RUN npm ci --ignore-scripts

RUN npm install
COPY --chown=node:node . ./
RUN node --run check:types

COPY . /app

CMD ["node" , "/app/app.js"]
CMD ["node" , "app.ts"]
35 changes: 0 additions & 35 deletions end2end/server/app.js

This file was deleted.

38 changes: 38 additions & 0 deletions end2end/server/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// This is an insecure mock server for testing purposes

import express from "express";
import { getConfig } from "./src/handlers/getConfig.ts";
import { captureEvent } from "./src/handlers/captureEvent.ts";
import { listEvents } from "./src/handlers/listEvents.ts";
import { createApp } from "./src/handlers/createApp.ts";
import { checkToken } from "./src/middleware/checkToken.ts";
import { updateConfig } from "./src/handlers/updateConfig.ts";
import { lists } from "./src/handlers/lists.ts";
import { updateIPLists } from "./src/handlers/updateLists.ts";
import { realtimeConfig } from "./src/handlers/realtimeConfig.ts";

const app = express();
app.set("trust proxy", false);
app.set("x-powered-by", false);

const port = process.env.PORT || 3000;

app.use(express.json());

app.get("/api/runtime/config", checkToken, getConfig);
app.post("/api/runtime/config", checkToken, updateConfig);

// Realtime polling endpoint
app.get("/config", checkToken, realtimeConfig);

app.get("/api/runtime/events", checkToken, listEvents);
app.post("/api/runtime/events", checkToken, captureEvent);

app.get("/api/runtime/firewall/lists", checkToken, lists);
app.post("/api/runtime/firewall/lists", checkToken, updateIPLists);

app.post("/api/runtime/apps", createApp);

app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});
Loading