File size: 593 Bytes
fd0873a
 
 
 
 
7c842da
90ee8c2
fd0873a
7a5d54d
7c842da
fd0873a
6088b24
7c842da
 
 
 
90ee8c2
 
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
25
import { apiReference } from "@scalar/express-api-reference";
import express from "express";

const app = express();

app.use("/", (req, res, next) => {	
	return apiReference({
		url: "https://huggingface.co/.well-known/openapi.json",
		title: "Hub API Endpoints",
		pageTitle: "Hub API Endpoints",
		hideClientButton: true,
		defaultOpenAllTags: true,
		onSidebarClick:  (href) => {
			const url = new URL(href);
			parent.postMessage({ hash: url.hash.slice(1) }, '*');
		},
	})(req, res);
});

const port = 7860;

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