flash_get_server
v1.0.5
Published
this is a mock server , having get req only
Readme
🌀 flash_get_server - One-liner GET Request Server
flash_get_server is a lightweight, plug-and-play function that allows you to create a GET request server in just one line. It’s perfect for quickly serving mock data for prototyping, testing, or demos.
🚀 Features
- One-liner server creation
- Multiple API endpoints
- Only supports
GETrequests (no POST/PUT/DELETE) - Easy to configure with a simple data structure
📦 Installation
Install via npm:
npm i flash_get_server🛠 Usage
Here’s how you can use it to spin up a GET server on port 3000:
// Import My_Server
const My_Server = require('flash_get_server');
// or
// import My_Server from 'flash_get_server'
// Define routes and data
const routes = [
{
api_path: '/users',
data: [
{ id: 1, name: 'Alice' },
{ id: 2, name: 'Bob' }
]
},
{
api_path: '/products',
data: [
{ id: 'p1', name: 'Laptop' },
{ id: 'p2', name: 'Phone' }
]
}
];
// Spin up the server in one line!
My_Server(3000, routes);edit api and data json data according to your need
📋 Notes
- Only
GETrequests are supported. - Any other request methods (POST, PUT, DELETE) will return
404 Non existing route. - Designed for simplicity and rapid prototyping.
🧑💻 License
adarshtech251
