A lightweight, zero-dependency mock API server for rapid prototyping and testing. Get a full REST API running in seconds!
- Zero Config: Works out of the box with default data
- RESTful: Full CRUD operations (GET, POST, PUT, DELETE)
- CORS Enabled: Perfect for frontend development
- Persistent: Data saves to JSON file automatically
- No Dependencies: Pure Node.js, no npm packages needed
- Fast: Lightweight and blazing fast
# Clone the repo
git clone https://github.com/DonkRonk17/json-api-mock.git
cd json-api-mock
# Start the server
node server.js
# Server running at http://localhost:3000node server.js # Default port 3000
node server.js 8080 # Custom port
node server.js 3000 data.json # Custom data fileGet all items
GET http://localhost:3000/users
GET http://localhost:3000/posts
GET http://localhost:3000/productsCreate new item
POST http://localhost:3000/users
Content-Type: application/json
{
"name": "New User",
"email": "user@example.com"
}Update item
PUT http://localhost:3000/users/1
Content-Type: application/json
{
"name": "Updated Name"
}Delete item
DELETE http://localhost:3000/users/1- users: Sample user data with roles
- posts: Blog posts with likes
- products: Product catalog with prices
- Frontend Development: Test your app without a backend
- Prototyping: Quick API for demos and POCs
- Testing: Mock API for integration tests
- Learning: Practice API calls and CRUD operations
Create a mock-data.json file:
{
"todos": [
{ "id": 1, "task": "Build API", "done": true }
],
"notes": [
{ "id": 1, "title": "Note", "content": "Content here" }
]
}Start with custom data:
node server.js 3000 mock-data.json# Get all users
curl http://localhost:3000/users
# Create a new post
curl -X POST http://localhost:3000/posts \
-H "Content-Type: application/json" \
-d '{"title":"New Post","content":"Hello World"}'
# Update a product
curl -X PUT http://localhost:3000/products/1 \
-H "Content-Type: application/json" \
-d '{"price":899.99}'
# Delete a user
curl -X DELETE http://localhost:3000/users/3- Automatic ID generation for new items
- Data persistence across restarts
- Clean JSON responses
- Request logging
- Error handling
Just Node.js - no npm install needed!
Contributions welcome! Feel free to submit PRs.
MIT License
Created by Randell Logan Smith and Team Brain at Metaphy LLC
Part of the HMSS (Heavenly Morning Star System) ecosystem.
Happy Mocking! 🎭✨