coyotte508 commited on
Commit
90ee8c2
·
1 Parent(s): f3942aa
Files changed (1) hide show
  1. app.ts +12 -9
app.ts CHANGED
@@ -3,18 +3,21 @@ import express from "express";
3
 
4
  const app = express();
5
 
6
- app.use(
7
- "/",
8
- (req, res, next) => {
9
- const originalSend = res.send.bind(res);
10
- res.send = x => originalSend(x.replace("</html>", "<script>addEventListener('hashchange', event => parent.postMessage({data: {hash: event.newURL.hash.slice(1)}}))</script></html>"))
11
- return apiReference({
 
 
 
 
12
  url: "https://huggingface.co/.well-known/openapi.json",
13
  hideClientButton: true,
14
  defaultOpenAllTags: true,
15
- })(req, res, next);
16
- };
17
- );
18
 
19
  const port = 7860;
20
 
 
3
 
4
  const app = express();
5
 
6
+ app.use("/", (req, res, next) => {
7
+ const originalSend = res.send.bind(res);
8
+ res.send = (x) =>
9
+ originalSend(
10
+ x.replace(
11
+ "</html>",
12
+ "<script>addEventListener('hashchange', event => parent.postMessage({data: {hash: event.newURL.hash.slice(1)}}))</script></html>"
13
+ )
14
+ );
15
+ return apiReference({
16
  url: "https://huggingface.co/.well-known/openapi.json",
17
  hideClientButton: true,
18
  defaultOpenAllTags: true,
19
+ })(req, res);
20
+ });
 
21
 
22
  const port = 7860;
23