Skip to content

This repository contains the backend API for the ShelfLife application, a book tracking app built with the MERN (MongoDB, Express.js, React, Node.js) stack.

License

Notifications You must be signed in to change notification settings

blockchaincyberpunk1/shelflife-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShelfLife Backend

This repository contains the backend API for the ShelfLife application, a book tracking app built with the MERN (MongoDB, Express.js, React, Node.js) stack.

Table of Contents

Getting Started

Prerequisites

  • Node.js and npm (or yarn) installed on your system.
  • A MongoDB database (local or cloud-based).

Installation

  1. Clone the repository:
    git clone https://github.com/blockchaincyberpunk1/shelflife-backend.git 
  2. Navigate to the project directory:
    cd shelflife-backend
  3. Install dependencies:
    npm install 

Environment Variables

Create a .env file in the root directory of the project and add the following environment variables:

MONGO_URI=your_mongodb_connection_string 
JWT_SECRET=your_strong_random_secret
PORT=your_desired_port (optional)
  • Replace the placeholders with your actual values.

Running the Server

  • Development Mode:
    npm run dev  // Uses nodemon to automatically restart the server on changes
  • Production Mode:
    npm start
    (Make sure to build your app for production using npm run build before deploying.)

API Endpoints

The following API endpoints are available:

Books:

  • GET /api/books: Fetch all books.
  • GET /api/books/shelf/:shelf: Fetch books by shelf (replace :shelf with the shelf name, e.g., currentlyReading).
  • PUT /api/books/:id: Update a book's shelf (replace :id with the book's ID).
  • POST /api/books (optional): Add a new book.

Authentication (if implemented):

  • POST /api/auth/signup: Create a new user account.
  • POST /api/auth/login: Log in a user.

Testing

To run the tests, execute the following command:

npm test

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you'd like to contribute to the project.

About

This repository contains the backend API for the ShelfLife application, a book tracking app built with the MERN (MongoDB, Express.js, React, Node.js) stack.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published