"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TranslateServer = void 0; const express_1 = __importDefault(require("express")); class TranslateServer { constructor() { this.queue = []; this.inprogress = false; this.app = (0, express_1.default)(); this.port = 3100; this.route = ""; } async prepare() { throw console.error("this is abstract"); } async listen() { //Import puppeteer function // await this.hybridTranslator.init(); await this.prepare(); this.app.get('/start', (request, response) => { response.status(200); response.json({ "status": "started" }); }); this.app.get('/stop', (request, response) => { // clearInterval(timerInterval); response.status(200); response.json({ "status": "stoped" }); }); this.app.use((req, res, next) => { if (this.inprogress) { this.queue.push({ req, res, next }); } else { next(); } }); this.app.use((req, res, next) => { if (this.queue.length > 0) { const queued = this.queue.shift(); queued.next(); } next(); }); this.app.get('/', (req, res) => res.send('Hi Hybrid')); //Initialises the express server on the port 30000 this.app.listen(this.port, "0.0.0.0", () => { console.log(`app listening to localhost:${this.port}!`); console.log("example http://localhost:3100/start"); console.log(`example http://localhost:${this.port + this.route}/`); }); } } exports.TranslateServer = TranslateServer;
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Browcore.js | File | 6.89 KB | 0644 |
|
HybridTranslate.js | File | 6.05 KB | 0644 |
|
HybridTranslateDeDe.js | File | 2.2 KB | 0644 |
|
HybridTranslateDeFa.js | File | 2.03 KB | 0644 |
|
HybridTranslateFaDe.js | File | 2.99 KB | 0644 |
|
TranslateServer.js | File | 1.91 KB | 0644 |
|
TranslateServerDeDe.js | File | 1.37 KB | 0644 |
|
TranslateServerDeFa.js | File | 1.37 KB | 0644 |
|
TranslateServerFaDe.js | File | 1.37 KB | 0644 |
|
generate-cookie.js | File | 635 B | 0644 |
|
main.js | File | 1.85 KB | 0644 |
|
server-de-fa.js | File | 2.88 KB | 0644 |
|
server.js | File | 764 B | 0644 |
|