{
"status": 200,
"ok": true,
"data": [
{
"_id": "61ba1b7024a1157ef54f121d",
"title": "Alice's Adventures in the Wonderland",
"author": "Lewis Carroll",
"language": "English",
"genres": ["Fantasy", "Literary nonsense"],
"country": "United Kingdom",
"countryCode": "GB",
"year": 1865,
"files": [
{
"type": "Vorwärts",
"extension": "epub",
"url": "https://raw.githubusercontent.com/vonweinKeller/vorwarts-library/main/alice/Alice'sAdventuresinWonderland.epub"
}
],
"user": "caian"
}
]
}
Vorwärts was born to be an easy way to get books in the public domain, free of any advertising and in a completely transparent way. The ideology of Vorwärts is to maintain the neutrality of all these books written by amazing authors and that now belong to everyone.
https://vorwartsapi.herokuapp.com
- /books
- /book
- /genres
- /countries
- /signup
- /login ...
GET
| Get books data.
All requests are sorted by author ascending..
parameters
Title
Author
Year
Year of publication. E.g.: {"year": "1984"}.
Country
Stands for the country where the book was originally published. The short version of the name should be used. E.g.: {"country": "Germany"}.
Language
Language originally written, the download options will usually be in the same language.
Genres
A slightly different field. To pass more than one gender, divide it into commas. E.g.: {"genres": "Fantasy, Children's Book"}.
Limit
Stands for limit of books per request. The default limit is 10.
Offset
Skip the first books.
Groupby
Group books by field. Try: author, genres, year, country or language. E.g.: {"groupby": "author"}.
axios.get("https://vorwartsapi.herokuapp.com/books", {
parameters: {
author: "Johann Wolfgang von Goethe",
groupby: "author",
},
});
{
"status": 200,
"ok": true,
"data": [
{
"author": "Johann Wolfgang von Goethe",
"books": [
{
"_id": "61ba1d7e24a1157ef54f1220",
"title": "The Sorrows of Young Werther",
"author": "Johann Wolfgang von Goethe",
"genres": ["Epistolary novel"],
"language": "German",
"country": "Germany",
"year": 1774,
"countryCode": "DE",
"user": "caian",
"files": []
}
]
}
]
}
GET
| Get countries with books available.
parameters
No parameters are available.
{
"status": 200,
"ok": true,
"data": [
"United Kingdom",
"Italy",
"Germany",
"Portugal",
"Russian Federation"
]
}
GET
| Get all genres in the database.
parameters
No parameters are available.
{
"status": 200,
"ok": true,
"data": [
"Fantasy",
"Literary nonsense",
"Children's book",
"Epistolary novel",
"Gothic novel",
"Horror fiction",
"Horror",
"Gothic",
"Absurdist fiction",
"Fiction",
"Mystery",
"Epic Poetry",
"Philosophical Novel",
"Psychological Fiction",
"Crime Fiction",
"Classic",
"Regency Novel"
]
}
They, unlikely public ones, affects the database.
POST
| Post an user in the database.
parameters
Username
At least 4 characters longer.
Email
Password
This will be encrypted.
axios.post("https://vorwartsapi.herokuapp.com/signup", {
username: "Johann Wolfgang von Goethe",
email: "[email protected]",
password: "hyper secure password",
});
{ "status": 201, "ok": true }
GET
| Make authentication in passed credentials.
parameters
Username
Password
axios.get("https://vorwartsapi.herokuapp.com/login", {
parameters: {
username: "Johann Wolfgang von Goethe",
password: "hyper secure password",
},
});
{
"status": 200,
"ok": true,
"message": "user authenticated",
"token": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MjUxZGVhZTI3NDZkNTc4ZDVjZDkyNDIiLCJpYXQiOjE2NDk1MzM1MjEsImV4cCI6MTY0OTYxOTkyMX0.LnT2VN9xYRzQGOWKc1RglIgScRI5_mYaEX6eIV_wwWg",
"username": "Johann Wolfgang von Goethe",
"email": "[email protected]"
}
GET
| Creates a token. This token longer for 1 week
This method will soon be improved by creating a token manager.
parameters
Token
Pass the current token throught headers as "authorization"
axios.get("https://vorwartsapi.herokuapp.com/token", {
headers: {
authorization:
"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MjUxZGVhZTI3NDZkNTc4ZDVjZDkyNDIiLCJpYXQiOjE2NDk1MzM1MjEsImV4cCI6MTY0OTYxOTkyMX0.LnT2VN9xYRzQGOWKc1RglIgScRI5_mYaEX6eIV_wwWg",
},
});
{
"status": 201,
"ok": true,
"token": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MjRlNGQxODk0MDdiNTE2OThmZDk3NDkiLCJpYXQiOjE2NDk3MDQ0NDMsImV4cCI6MTY0OTc5MDg0M30.F_qLlM5aQGUjnPH_sMevG5YrKRoEzLQ5uWZ-6pnFveQ"
}
POST
| Publish a book in the database.
File uploads are not available yet.
parameters
Token
Pass the current through the headers as "authorization".
Title
Author
Year
Country
Tends to write in English, the standart is available here.
CountryCode
In Alpha 2. E.g.: US for United States or GB for United Kingdom (see more).
Language
Tends to write in English, the standart is available here.
Genres
Array, E.g: ["fantasy", "children's book"].
axios.get("https://vorwartsapi.herokuapp.com/login", {
title: "The Sorrows of Young Werther",
author: "Johann Wolfgang von Goethe",
year: "1774",
country: "Germany",
countryCode: "DE",
language: "German",
"genres": [
"Epistolary novel"
]},
headers: {
"authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MjUxZGVhZTI3NDZkNTc4ZDVjZDkyNDIiLCJpYXQiOjE2NDk1MzM1MjEsImV4cCI6MTY0OTYxOTkyMX0.LnT2VN9xYRzQGOWKc1RglIgScRI5_mYaEX6eIV_wwWg",
}
})
{
"status": 201,
"ok": true,
"token": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MjRlNGQxODk0MDdiNTE2OThmZDk3NDkiLCJpYXQiOjE2NDk3MDQ0NDMsImV4cCI6MTY0OTc5MDg0M30.F_qLlM5aQGUjnPH_sMevG5YrKRoEzLQ5uWZ-6pnFveQ"
}
This is a simple MVC server in Node, you won't be lost.
Set .env
file with
BD_URL={mongoose database url}
JSON_WEB_TOKEN_KEY=//any string of your choice
Use npm start
or node src/app.js
▲ npm start
> [email protected] start
> node src/app.js
We've taken off 🛫 on 4000 port