Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 665 Bytes
fd0873a f3942aa fd0873a 6088b24 f3942aa fd0873a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import { apiReference } from "@scalar/express-api-reference";
import express from "express";
const app = express();
app.use(
"/",
(req, res, next) => {
const originalSend = res.send.bind(res);
res.send = x => originalSend(x.replace("</html>", "<script>addEventListener('hashchange', event => parent.postMessage({data: {hash: event.newURL.hash.slice(1)}}))</script></html>"))
return apiReference({
url: "https://huggingface.co/.well-known/openapi.json",
hideClientButton: true,
defaultOpenAllTags: true,
})(req, res, next);
};
);
const port = 7860;
app.listen(port, () => {
console.log(`Server running on port ${port}`);
});
|