# Web Management Interface ๐ฑ
Access management interface: http://localhost:9005 (opens new window)
# ๐ Request Monitoring
# Real-time Request List
All intercepted requests are displayed in real-time with support for sorting and searching.
Column | Description | Function |
---|---|---|
ID | Unique request identifier | Click to view details |
Code | HTTP status code | ๐ข 2xx ๐ก 3xx ๐ด 4xx/5xx |
Type | Response content type | JSON, HTML, images, etc. |
Method | HTTP request method | GET, POST, PUT, DELETE |
API | Request path | Supports search filtering |
# Quick Operations
- ๐ Search & Filter - Quickly find by path, status code, method
- ๐ Sort - Click column headers to sort by any column
- ๐ Auto Refresh - New requests display in real-time
# ๐ฌ Request Details
# Core Features
# ๐ Replay
One-click error reproduction: Re-send requests with identical parameters.
Use Cases:
- ๐ Quickly reproduce bugs without re-login
- ๐งช Test API stability
- ๐ Verify fix effectiveness
# ๐ธ Capture
Quick documentation: One-click capture of current page state.
Suitable for:
- ๐ Bug report attachments
- ๐ Interface state recording
- ๐ค Sharing issues with team
# ๐ Swagger Integration
Auto-linked documentation: Automatically displays corresponding Swagger debug interface after OpenAPI configuration.
Core Advantages:
- ๐ Automatically carries latest token, no manual login needed
- ๐ View complete interface definitions and parameter descriptions
- ๐งช Test interfaces directly in documentation
# ๐ History
Parameter comparison tool: View all request history for the same interface.
Column | Description |
---|---|
Code | HTTP status code |
Req | Request body size (query + body) |
Res | Response body size |
Usage Tips:
- ๐ Quickly locate anomalies by request/response size
- ๐ Compare parameter differences between requests
- ๐งญ Sort by size to quickly find problematic requests
๐ก Common Issues
Q: Page not updated after replay?
A: Replay generates new request records, check latest results in History.
Q: Capture feature not working?
A: May fail with excessive page content or iframes, recommend using professional screenshot tools.
Q: Swagger button not showing?
A: Check if OpenAPI configuration is correct and current interface exists in documentation.
# ๐ Request Response Details
Complete HTTP communication display:
Request Section:
- ๐ Request Line - Method, URL, query parameters
- ๐ Request Headers - Complete Headers information
- ๐ฆ Request Body - POST/PUT data content
Response Section:
- โ Status Line - Status code, status message
- ๐ Response Headers - Server returned Headers
- ๐ Response Body - Actual returned data content
View Request Details
๐ก JSON Preview Tip
Ensure response header Content-Type
is application/json
for proper preview. Recommend backend using res.json()
instead of res.send()
.
# โ๏ธ Interface Management
# ๐๏ธ Interface Control Panel
Visual management of all interfaces with WebAPI online editing support.
If there are no real interfaces yet, you can use this feature to create interfaces|documentation
for frontend-backend reference. It describes request addresses, methods, parameter positions, types, responses, and can generate interfaces for frontend calls.
Interfaces created here are called webApi interfaces, which merge with interfaces written in config.api. Duplicates are overridden by the latter.
MockM converts filled field names, example values, types
into corresponding response data, supporting MockJS syntax.
Conversion Rules
- Field name: The name of the field, can use MockJS generation rules.
- Example value: Example value for the field, supports MockJS syntax, like @cname for random Chinese names.
Quick Operations:
- โ New Interface - Click
+
button in table header - ๐ Batch Toggle - One-click disable/enable all WebAPI
- โ๏ธ Individual Control - Control single interface enable status
# โ๏ธ Online Interface Editor
# ๐ฏ Edit Mode Selection
# ๐ Table Mode - Quick Structured Data Building
Use Cases: Structured data, API prototype design
Core Features:
- ๐ Field Definition - Field name, example value, type settings
- ๐ฒ Data Generation - Supports MockJS syntax
- ๐ Real-time Preview - Immediate view of generated effects
- ๐ง Response Header Settings - Custom HTTP Headers
Supported Field Types:
Type | Description | Example |
---|---|---|
string | String | "username" |
number | Number | 123 , 3.14 |
boolean | Boolean | true , false |
object | Object | Nested field structure |
array | Array | Array object collection |
eval | JS Code | Date.now() , Mock.mock('@name') |
Enhanced MockJS Support:
- ๐ญ Placeholders - Like
@name
(name),@email
(email) - ๐ข Quantity Control - Like
name|2-5
(2-5 characters) - ๐ Rule Generation - Like
list|10-20
(10-20 data items)
Shortcuts:
Ctrl+S
- Save interfaceCtrl+E
- Switch to code mode
# ๐ป Code Mode - Complete Custom Logic
Use Cases: Complex business logic, conditional responses
Global tool
Object:
{
libObj: {
mockjs, // MockJS instance
axios // HTTP request library
},
wrapApiData, // Unified data wrapper function
listToData, // Table data conversion function
cur // Current interface information
}
Practical Example:
(req, res) => {
const { wrapApiData, listToData, cur, libObj: { mockjs } } = tool
// Get request parameters
const { body, query, params } = req
// Return different data based on parameters
if (query.type === 'error') {
return res.status(500).json({ error: 'Simulated error' })
}
// Use table data
const { table, example } = cur.responses['200']
const tableData = listToData(table, example).data
// Combine return data
const data = {
user: mockjs.mock('@name'),
timestamp: Date.now(),
request: { body, query, params },
tableData
}
// Set custom response headers
res.set({ 'X-Custom-Header': 'MockM Generated' })
// Return unified format data
res.json(wrapApiData({ data, code: 200 }))
}
# ๐ History Mode - Reuse Real Data
Use Cases:
- ๐ Reproduce Issues - Use response data from specific requests
- ๐งช A/B Testing - Fix a successful response
- ๐ Data Consistency - Ensure stable test environment data
Operation Method: Input historical request ID, the interface will always return the complete response (including Headers) of the specified request.
# ๐ Batch Operations
# ๐ Text Import - Quick Field Structure Creation
Double-click table add button, enter structured text in popup:
User Information
- Name
- Email
- Avatar
- Profile
- Age
- Birthday
- Phone
- Address Info
- Province
- City
- Detailed Address
Smart Features:
- ๐ Auto Translation - Chinese field names auto-generate English key names
- ๐ฏ Type Inference - Smart type inference based on field names
- ๐ฒ Mock Generation - Auto-match appropriate MockJS rules
Hierarchy Support:
- Use
-
or space indentation for sub-levels - Support multi-level nested structures
- Auto-generate object and array types
๐ก Pro Tips
Table Mode vs Code Mode Selection:
- ๐ Table Mode - Suitable for quick prototypes, clearly structured APIs
- ๐ป Code Mode - Suitable for complex logic, dynamic responses, conditional judgments
- ๐ History Mode - Suitable for reproducing issues, fixed test data
Best Practices:
- Use table mode for quick scaffolding of new interfaces
- Switch to code mode when logic judgment is needed
- Temporarily use history mode when debugging issues
Save Methods:
Ctrl+S
- Shortcut save- Click
Action โ Save
- Menu save - Auto-save prompt - Shows save status after modifications
โ Examples Command Line Arguments โ