Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🐾 Pet Store API

A RESTful API for managing a pet store, built with Fastify and Node.js.

🚀 Features

  • 🔐 User Authentication with API Keys (only for 1 endpoint)
  • 🐕 Pet Management
  • 🛍️ Store Operations
  • 📦 Order Processing

🛠️ Tech Stack

  • Node.js
  • Fastify
  • JSON File Storage

📋 API Endpoints

👤 User Endpoints

  • GET /user/login - Login user and get API key
    • Query params: username, password
  • GET /user/logout - Logout user
    • Query params: username
  • GET /user/:username - Get user by username
  • PUT /user/:username - Update user
  • POST /user - Create new user
  • POST /user/createWithList - Create multiple users
  • DELETE /user/:username - Delete user

🐕 Pet Endpoints

  • GET /pet/:id - Get pet by ID
  • GET /pet/findByStatus - Find pets by status
  • GET /pet/findByTags - Find pets by tags
  • POST /pet/:id/uploadImage - Upload pet image (only .jpg)
  • POST /pet/:id - Update pet with form data
  • POST /pet - Add new pet
  • PUT /pet - Update pet
  • DELETE /pet/:id - Delete pet

🛍️ Store Endpoints

  • GET /store/inventory - Get pet inventory by status
    • Requires API key
  • GET /store/order/:orderId - Find purchase order by ID
  • POST /store/order - Place an order for a pet
  • DELETE /store/order/:orderId - Delete purchase order by ID

🔑 Authentication

One endpoint ( GET /store/inventory) require an API key for authentication that is granted on login. The API key should be included in the request header:

api_key: your_api_key_here

📦 Data Structure

User

{
  "id": 1,
  "username": "string",
  "firstName": "string",
  "lastName": "string",
  "email": "string",
  "password": "string",
  "phone": "string",
  "userStatus": 0
}

Pet

{
  "id": 1,
  "name": "string",
  "photoUrls": ["string"],
  "category": {
    "id": 1,
    "name": "string"
  },
  "tags": [
    {
      "id": 1,
      "name": "string"
    }
  ],
  "status": "available"
}

Order

{
  "id": 1,
  "petId": 1,
  "quantity": 1,
  "shipDate": "2024-03-20T12:00:00Z",
  "status": "placed",
  "complete": false
}

🚀 Getting Started

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Start the server:
    npm start dev

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages