# 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'
}