-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (22 loc) · 817 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const express = require("express");
const { createProxyMiddleware } = require("http-proxy-middleware");
const app = express();
// // Status route
// app.get("/status", (req, res) => {
// res
// .status(200)
// .send({ status: "OK", message: "Server is running smoothly." });
// });
// Configure proxy middleware
const ollamaProxy = createProxyMiddleware({
target: "http://localhost:11434", // Target host
changeOrigin: true, // Needed for virtual hosted sites
ws: true, // Proxy websockets
});
// Example: Forward all requests from /ollama to the ollama application
app.use("/", ollamaProxy);
// Alternatively, to proxy all incoming requests to the ollama app, use this:
// app.use(ollamaProxy);
app.listen(11435, "0.0.0.0", () => {
console.log("Express server is running on port 11435");
});