Authentication API and Book Events Package

This package provides an authentication API and book events functionality using Express.js, MongoDB, JWT, and bcrypt. It allows users to register, login, and manage book events.

Installation

To use this package, you need to have Node.js and npm (Node Package Manager) installed on your system. Clone this repository and follow the steps below:

  1. Install dependencies:

    npm install
  2. Create a .env file in the root directory and provide the necessary configuration parameters:

    PORT=3000
    DB_URI=mongodb://localhost:27017/auth_express_mongodb
    JWT_SECRET=mysecretkey
    
  3. Run the server:

    npm start

API Endpoints

Authentication

  • POST /auth/register: Register a new user.
  • POST /auth/login: Authenticate a user and receive a JWT token.

Book Events

  • POST /events/create: Create a new book event.
  • GET /events: Get a list of all book events.
  • GET /events/:id: Get details of a specific book event.
  • PUT /events/:id: Update details of a book event.
  • DELETE /events/:id: Delete a book event.

Usage

  1. Register a user using the /auth/register endpoint.
  2. Authenticate a user and receive a JWT token using the /auth/login endpoint.
  3. Use the received token for authorization in book events endpoints.

Contributing

Contributions are welcome! If you find any issues or want to enhance the package, feel free to open a pull request.

License

This package is licensed under the ISC License.