360-mock-server
v1.2.6
Published
π Zero-config dynamic mock REST API server with Faker.js auto-generation for frontend developers
Maintainers
Readme
π 360 Mock Server
360 Mock Server is a zero-config mock REST API for frontend developers. Create, update, delete, paginate, and auto-generate fake data without building a backend.
Perfect for React / React Native / Redux / demos / testing.
β¨ Features
- Zero configuration
- Works with any REST endpoint
- Full CRUD (GET, POST, PUT, PATCH, DELETE)
- Fake data generation (Faker.js)
- Pagination support
- Persistent JSON storage
- Interactive CLI + REST API
- CORS enabled
π¦ Installation
npm install -g 360-mock-server
# or
npx 360-mock-serverβ‘ Start Server
npx 360-mock-serverServer runs at:
http://localhost:5050π§ Manual + Faker + Pagination (All-in-One)
βΆοΈ Manual CRUD (Normal API)
POST /users
{ "name": "Ali", "email": "[email protected]" }
GET /users
GET /users/123
PATCH /users/123
{ "email": "[email protected]" }
DELETE /users/123π² Faker.js β Auto Generate Fake Data
Just send fields array:
POST /users
{
"fields": ["name", "email", "avatar", "phone"],
"count": 10
}Works for any resource:
POST /products
{
"fields": ["productName", "price", "category"],
"count": 20
}Get all supported faker fields:
GET /faker/fieldsπ Pagination (Built-in)
GET /users?_page=1&_limit=5Response:
{
"data": [...],
"pagination": {
"page": 1,
"limit": 5,
"totalItems": 20,
"totalPages": 4,
"hasNextPage": true,
"hasPrevPage": false
}
}- Pagination works on any resource
- If
_limitis missing β returns full array
π» Frontend Usage
Fetch
fetch('http://localhost:5050/users')
.then(res => res.json())
.then(console.log);Axios
axios.get('http://localhost:5050/users', {
params: { _page: 1, _limit: 10 }
});π₯ Interactive CLI
After starting server:
360-mock> POST /users {"name":"Ali"}
360-mock> GET /users
360-mock> DELETE /users/123Commands:
listβ list resourcesclearβ clear terminalexitβ quit
βοΈ Options
npx 360-mock-server --port 4000
npx 360-mock-server --file db.jsonπΎ Storage
Data is stored locally in:
mock-data.jsonπͺͺ License
MIT Β© 360XpertSolution Built by zahidrahimoon
