Skip to content

How to use

Davenchy edited this page Jan 7, 2020 · 4 revisions

Environment Variables

Note: you can use .env file to setup vars

Var Default Desc
PORT 3000 server listening port
OSUA TemporaryUserAgent Opensubtitles.org User Agent

for more information about the OpenSubtitles.org api user agent from here

Use As A User

  • Install dependencies npm install

  • Start the server npm start

  • Or you can env vars PORT=3000 OSUA=SOME_USER_AGENT npm start

For developers

  • Install dependencies npm install -D

  • Then start the dev server npm run dev

Note: The same env vars are applied

Use as an express.js middleware

const app = require("express")();
const liveTorrentBackend = require("live-torrent-backend");

app.use(liveTorrentBackend());

app.listen(3000, () => console.log("server is running on port 3000"));

Note: The same OSUA env var is applied

  • by default the server using the next middle wares:

. cors

. morgan

. body-parser

  • Note you can display them by the next line of code:

app.use(liveTorrentBackend(true));