🪛 Refactoring and validation
This commit is contained in:
@@ -1,6 +1,32 @@
|
||||
import express, { Request, Response, Router, Express } from "express";
|
||||
import bodyParser from "body-parser";
|
||||
import router from "./route";
|
||||
import path from "path";
|
||||
|
||||
import { Server } from "r2-streamer-js";
|
||||
|
||||
const OPDSServer = new Server({
|
||||
disableDecryption: false, // deactivates the decryption of encrypted resources (Readium LCP).
|
||||
disableOPDS: false, // deactivates the HTTP routes for the OPDS "micro services" (browser, converter)
|
||||
disableReaders: false, // deactivates the built-in "readers" for ReadiumWebPubManifest (HTTP static host / route).
|
||||
disableRemotePubUrl: false, // deactivates the HTTP route for loading a remote publication.
|
||||
maxPrefetchLinks: 5, // Link HTTP header, with rel = prefetch, see server.ts MAX_PREFETCH_LINKS (default = 10)
|
||||
});
|
||||
|
||||
const url = async () => await OPDSServer.start(5643, false);
|
||||
url().then(async (res) => {
|
||||
console.log(res);
|
||||
const publicationURLs = OPDSServer.addPublications([
|
||||
"http://localhost:3000/comics/Iron Man/Iron Man - V1 193.cbz",
|
||||
]);
|
||||
console.log(publicationURLs);
|
||||
OPDSServer.publicationsOPDS();
|
||||
|
||||
const publication = await OPDSServer.loadOrGetCachedPublication(
|
||||
"http://localhost:3000/comics/Iron Man/Iron Man - V1 193.cbz",
|
||||
);
|
||||
console.log(publication);
|
||||
OPDSServer.publicationsOPDS();
|
||||
});
|
||||
|
||||
// call express
|
||||
const app: Express = express(); // define our app using express
|
||||
@@ -23,8 +49,6 @@ app.get("/", (req: Request, res: Response) => {
|
||||
|
||||
// REGISTER ROUTES
|
||||
// all of the routes will be prefixed with /api
|
||||
const routes: Router[] = Object.values(router);
|
||||
app.use("/api", routes);
|
||||
|
||||
app.listen(port);
|
||||
console.log(`App listening on ${port}`);
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import extra from "./routes/importComics.routes";
|
||||
|
||||
export default { extra };
|
||||
Reference in New Issue
Block a user