Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "server"

It takes the parameters in a query string, generates and returns an EPUB 3.2 instance to the caller.

The possible query parameters are

url              The URL for the content
respec           Whether the source is in respec (true) or a final HTML (false).
publishDate      Publication date
specStatus       Specification type
addSectionLinks  Add section links with "§"
maxTocLevel      Max TOC level

The module is a wrapper around a standard node.js http.CreateServer, and a call to create_epub.

Usage examples:

(In all examples, the URL for the server is set to https://epub.example.org)

Convert the HTML file (as generated by ReSpec) to an EPUB 3.2 file. The generated publication's name is short-name.epub, where short-name is set in the ReSpec configuration:

https://epub.example.org?url=https://www.example.org/doc.html

Convert the HTML ReSpec source to an EPUB 3.2 file. The source is converted on-the-fly by respec:

https://epub.example.org?url=https://www.example.org/doc.html&respec=true

Convert the HTML ReSpec source to an EPUB 3.2 file, setting its spec status to REC. The source is converted on-the-fly by respec, overwriting the specStatus entry in the configuration to REC:

https://epub.example.org?url=https://www.example.org/doc.html&respec=true&specStatus=REC

Generates a collection, described by the configuration file. (See the separate module for more details on the configuration file.)

 https://epub.example.org?url=https://www.example.org/collection.json

Index

Interfaces

Functions

Functions

get_epub

  • get_epub(query: Query): Promise<Content>
  • Generate the EPUB file. This is a wrapper around create_epub, creating the necessary arguments Options structure based on the incoming URL's query string.

    async

    Parameters

    • query: Query

      The query string from the client

    Returns Promise<Content>

serve

  • serve(): Promise<void>
  • Run a rudimentary Web server calling out to convert via get_epub to return an EPUB 3.3 instance when invoked. If there is no proper query string a fixed page is displayed.

    This function is automatically started when this module is used from a command line.

    async

    Returns Promise<void>