Giter Club home page Giter Club logo

epub-press's Introduction

epub-press

Build

Backend server for EpubPress.

For clients, see epub-press-clients.

Usage

This section is for those who want to simply run epub-press locally. If you want to develop epub-press, see the next section Development Setup.

You may use docker-compose to stand up both the epub-press server and the backing PostgreSQL database.

  1. Install Docker
  2. docker-compose up server

EpubPress will be running at http://localhost:3000.

Development Setup

Follow these instructions to run epub-press without Docker or develop epub-press.

Clone this repository and install npm dependencies. Use the node version indicated in .nvmrc. See the nvm project for details on Node Version Manager.

Install dependencies

$ git clone https://github.com/haroldtreen/epub-press
$ cd epub-press
$ # optional nvm use
$ npm install

You may develop this project backed by a PostgreSQL or SQLite database (the default for development and test environments).

  1. Install Docker
    1. With Sqlite echo DB_DIALECT=sqlite > .env.local
    2. With postgres docker-compose up postgres
  2. npm start

Run database migrations one time:

npm run db:migrate

EpubPress will be running at http://localhost:3000 and reload upon file changes.

To build a version of EpubPress that talks to a local server, see epub-press-chrome.

Tests

npm run test:integration   # Test API + full article extraction
npm run test:models        # Test models
npm run test:unit          # Test regular JS
npm run test               # Test all of the above

Changes should be accompanied by tests. All tests located in /tests.

API Documentation

API Documentation is here.

Simple workflow

$ # create a book
$ curl http://localhost:3000/api/v1/books \
 -H "Content-Type: application/json" \
 -X POST \
 -d '{
    "title": "A title",
    "description": "A description",
    "author": "An author",
    "genre": "ebooks",
    "coverPath": "",
    "urls": [
        "https://epub.press"
    ]
}'

{"id":"RXyGKmTq7"}
$ # download the book as epub file 
$ curl -o book.epub http://localhost:3000/api/v1/books/RXyGKmTq7/download
$ # or download as mobi file
$ curl -o book.mobi "http://localhost:3000/api/v1/books/RXyGKmTq7/download?filetype=mobi"
$ ls
book.epub

Environment variables

Name Default Description
MAIL_SERVER_HOST Hostname of SMTP mail server
MAIL_SERVER_PORT Port of SMTP mail server
MAIL_SERVER_TLS Leave blank by default. If using SSL/TLS for the SMTP connection, set the value to true.
MAIL_SERVER_USERNAME Username for SMTP authentication
MAIL_SERVER_PASSWORD Password for SMTP authentication
MAIL_SENDER_ADDRESS [email protected] Sender email address
MAX_NUM_SECTIONS 50 Sets the maximum number of articles in one book.

Build argument (in Dockerfile):

converter - leave as "calibre" to download and use Calibre for MOBI conversion (the setup for which assumes by default that the host is Debian-like). If not, or if there are errors, change the value of this variable to "kindlegen" to use the binaries in /bin/.

epub-press's People

Contributors

haroldtreen avatar dependabot[bot] avatar sanujar avatar wrobbins avatar saesh avatar gwynnarth avatar efreak avatar pushcx avatar taiphamd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.