# epub-press
**Repository Path**: rockgu/epub-press
## Basic Information
- **Project Name**: epub-press
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: GPL-3.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-14
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# epub-press

> Backend server for [EpubPress](https://epub.press).
For clients, see [epub-press-clients](https://github.com/haroldtreen/epub-press-clients).
### Setup
```bash
git clone https://github.com/haroldtreen/epub-press
cd epub-press
npm install
```
### Usage
**Docker Setup**
1. [Install Docker](https://docs.docker.com/engine/installation/)
1. `docker-compose up`
You'll also want to run database migrations if it's your first time running the service:
`npx sequelize-cli db:migrate`
EpubPress will be running at `http://localhost:3000`.
**Development Setup**
1. [Install Docker](https://docs.docker.com/engine/installation/)
1. `docker-compose up postgres`
1. `npm start`
You'll also want to run database migrations if it's your first time running the service:
`npx sequelize-cli 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](https://github.com/haroldtreen/epub-press-clients/tree/master/packages/epub-press-chrome#usage-with-local-server).
### Tests
```bash
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](./API.md).
#### Simple workflow
```sh
$ # 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": "https://via.placeholder.com/600x800.jpg?text=A%20Cover",
"urls": [
"https://epub.press"
]
}'
{"id":"RXyGKmTq7"}
$ # download the book
$ curl -o book.ebub http://localhost:3000/api/v1/books/RXyGKmTq7/download
$ ls
book.ebub
```
### Environment variables
| Name | Default | Description |
|------------------------|--------------------|-----------------------------------|
| `MAIL_SERVER_HOST` | | Hostname of SMTP mail server |
| `MAIL_SERVER_PORT` | | Port of SMTP mail server |
| `MAIL_SERVER_USERNAME` | | Username for SMTP authentication |
| `MAIL_SERVER_PASSWORD` | | Password for SMTP authentication |
| `MAIL_SENDER_ADDRESS` | noreply@epub.press | Sender email address |