Giter Site home page Giter Site logo

turbo-book's Introduction

API Documentation

url: 15.206.145.222:3000 Mock data to test api

1. open workbench
2. File > Open SQL Script grouple_db.sql from the repository
3. Run the script
4. Done

Setup

Before running the API server, make sure to follow these setup instructions:

  1. Clone the repository:
    git clone <repository_url>
  2. cd <project_directory>
npm install
or
yarn install
cp .env.example .env
fill the .env with the data

Mock data to test api

1. open workbench
2. File > Open SQL Script grouple_db.sql from the repository
3. Run the script
4. Done

Signup

Description: This API endpoint is used for user registration.

URL: /signup

Method: POST

Request Body:

{
  "email": "[email protected]",
  "password": "password123"
}

Login

Description: This API endpoint is used for user login.

URL: /login

Method: POST

Request Body:

{
  "email": "[email protected]",
  "password": "password123"
}

New Event

Description: This API endpoint is used to create a new event.

URL: /addEvents

Method: POST

Request Body:


{
  "title": "Event Title",
  "description": "Event Description",
  "availableSlots": 100,
  "thumbnail": "event_thumbnail_url"
}

Response:

Success Response: Status Code: 200 OK Body: json

{
  "message": "Event added",
  "event": {
    "title": "Event Title",
    "description": "Event Description",
    "availableSlots": 100,
    "thumbnail": "event_thumbnail_url"
  }
}

Error Response: Status Code: 500 Internal Server Error Body:

{ "error": "Internal server error" }

Get Events

Description: This API endpoint is used to retrieve a list of events.

URL: /getEvents

Method: GET

Query Parameters:

page (optional): Page number for pagination (default: 1) Response:

Success Response: Status Code: 200 OK Body:

{
  "events": [
    {
      "title": "Event Title",
      "description": "Event Description",
      "availableSlots": 100,
      "thumbnail": "event_thumbnail_url"
    },
}

Update Event

Description: This API endpoint is used to update an existing event.

URL: /updateEvent/:id

Method: PUT

Request Body:

{
  "title": "Updated Event Title",
  "description": "Updated Event Description",
  "availableSlots": 120,
  "thumbnail": "updated_thumbnail_url"
}

Response:

Success Response: Status Code: 200 OK Body:

{
  "message": "Event updated successfully",
  "event": {
    "title": "Updated Event Title",
    "description": "Updated Event Description",
    "availableSlots": 120,
    "thumbnail": "updated_thumbnail_url"
  }
}

Delete Event

Description: This API endpoint is used to delete an event.

URL: /deleteEvent/:id

Method: DELETE

Response:

Success Response: Status Code: 200 OK Body:

{
  "message": "Event deleted successfully"
}

Upload to S3

Description: This API endpoint is used to upload an image to Amazon S3.

URL: s3/upload

Method: POST

Request Body:

  • email: Email of the user
  • name: Name of the user

Request File:

  • Image file to be uploaded

Response:

  • Success Response:
    • Status Code: 200 OK
    • Body:
      {
        "message": "Image uploaded successfully"
      }

Retrieve from S3

Description: This API endpoint is used to retrieve images stored in Amazon S3.

URL: s3/get

Method: GET

Response:

  • Success Response:
    • Status Code: 200 OK
    • Body:
      {
        "data": [
          {
            "item": {
              "imageName": "userImage123456789.jpg",
              "email": "[email protected]",
              "name": "John Doe",
              "createdAt": "2024-04-29T12:00:00Z"
            },
            "signedUrl": "https://s3.amazonaws.com/bucket/userImage123456789.jpg"
          },
          {
            "item": {
              "imageName": "userImage987654321.jpg",
              "email": "[email protected]",
              "name": "Jane Doe",
              "createdAt": "2024-04-28T12:00:00Z"
            },
            "signedUrl": "https://s3.amazonaws.com/bucket/userImage987654321.jpg"
          }
        ]
      }

turbo-book's People

Contributors

thisisamandang avatar turbobot-temp avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.