LibrisAPI is a RESTful API for managing your personal book collection.
This API allows you to:
- Create, retrieve, update, and delete books.
- Authenticate users with JWT (JSON Web Tokens).
For detailed information on how to use the API, please refer to the LibrisAPI Documentation.
-
Clone the repository:
git clone https://github.com/Nec0ti/LibrisAPI/ cd LibrisAPI
-
Install dependencies:
npm install
-
Set up environment variables:
Create a
.env
file with the following variables:MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<database>?retryWrites=true&w=majority JWT_SECRET=your_jwt_secret_key
-
Start the server:
npm run dev
Here are a few basic examples:
-
Register:
POST /api/auth/register
{ "username": "testuser", "password": "testpassword" }
-
Login:
POST /api/auth/login
{ "username": "testuser", "password": "testpassword" }
-
Get All Books:
GET /api/books
(requires JWT token inx-auth-token
header)
We welcome contributions! Please feel free to open issues or submit pull requests.
This project is licensed under the MIT License.