# File System 📁

Understanding the file structure generated by MockM helps with data management and troubleshooting.

# 📊 Directory Structure

After running MockM, the following files will be generated in the dataDir directory:

httpData/                    # 📁 Data root directory
├── db.json                  # đŸ—ƒī¸ RESTful API data storage
├── httpHistory.json         # 📜 Request history index
├── store.json              # âš™ī¸ Application state information
├── apiWeb.json             # 🌐 Web UI created API configuration
├── log.err.txt             # 📝 Error logs
└── request/                # 📂 Request details storage directory
    ├── api_users_1001/     # 📁 Grouped by API path
    │   ├── get_1001_req.json    # 📤 Request details
    │   ├── get_1001_res.json    # đŸ“Ĩ Response details
    │   └── get_1001_info.json   # â„šī¸ Request metadata
    └── api_posts_1002/
        ├── post_1002_req.json
        ├── post_1002_res.json
        └── post_1002_info.json

# đŸ—ƒī¸ Core File Descriptions

# db.json - RESTful Database

Stores data defined through config.db.

Purpose:

  • 🔄 Data source for RESTful APIs
  • 📝 Persistence for CRUD operations
  • 🔍 Data foundation for search and pagination features

Example Structure:

{
  "users": [
    { "id": 1, "name": "John Doe", "email": "john@example.com" },
    { "id": 2, "name": "Jane Smith", "email": "jane@example.com" }
  ],
  "posts": [
    { "id": 1, "title": "First Article", "userId": 1 }
  ]
}

# httpHistory.json - Request Index

Records basic information of all requests for Web UI display.

Contains Information:

  • 📋 Request ID, method, path
  • ⏰ Timestamp, status code
  • 📊 Request/response size
  • 🔗 Associated detailed file paths

# apiWeb.json - Web API Configuration

Stores API definitions created through the Web interface.

Features:

  • âœī¸ API configurations edited online
  • 🔄 Data from table mode and code mode
  • đŸŽ›ī¸ Interface toggle status
  • 📋 Custom response header settings

# request/ - Request Details Directory

Stores complete information for each request, grouped by API path.

File Naming Convention:

  • {method}_{id}_req.json - Request details (Headers, Body, Query, etc.)
  • {method}_{id}_res.json - Response details (Status, Headers, Body, etc.)
  • {method}_{id}_info.json - Metadata (timestamp, processing time, etc.)

# âš™ī¸ Custom Storage Paths

You can adjust file storage locations through configuration:

Configuration Description Default Value
dataDir Data root directory ./httpData
dbJsonPath RESTful data file ${dataDir}/db.json
apiWeb Web API configuration file ${dataDir}/apiWeb.json

Example Configuration:

module.exports = {
  dataDir: './my-mock-data',
  dbJsonPath: './database/api-data.json',
  apiWeb: './config/web-apis.json'
}
Last Updated: 7/25/2025, 5:52:54 AM