11<div align =" center " >
2- <a href =" https://vite-plugin-ws-rest-fs -api.ndria.dev/ " >
3- <img src="https://raw.githubusercontent.com/nDriaDev/vite-plugin-ws-rest-fs -api/main/resources/img/logo_hd.png" alt="Go to web site">
2+ <a href =" https://vite-plugin-universal -api.ndria.dev/ " >
3+ <img src="https://raw.githubusercontent.com/nDriaDev/vite-plugin-universal -api/main/resources/img/logo_hd.png" alt="Go to web site">
44</a >
55<br >
66
7- # vite-plugin-ws-rest-fs -api
7+ # vite-plugin-universal -api
88
99### Seamless Mock APIs, Accelerate Your Development Journey
1010
11- [ ![ npm version] ( https://img.shields.io/npm/v/%40ndriadev/vite-plugin-ws-rest-fs- api?color=orange&style=for-the-badge )] ( https://www.npmjs.com/package/%40ndriadev/vite-plugin-ws-rest-fs -api )
12- ![ npm bundle size] ( https://img.shields.io/bundlephobia/minzip/%40ndriadev%2Fvite-plugin-ws-rest-fs -api?style=for-the-badge&label=SIZE&color=yellow )
13- [ ![ npm downloads] ( https://img.shields.io/npm/dt/%40ndriadev/vite-plugin-ws-rest-fs- api?label=DOWNLOADS&style=for-the-badge&color=red )] ( https://www.npmjs.com/package/%40ndriadev/vite-plugin-ws-rest-fs -api )
11+ [ ![ npm version] ( https://img.shields.io/npm/v/%40ndriadev/vite-plugin-universal- api?color=orange&style=for-the-badge )] ( https://www.npmjs.com/package/%40ndriadev/vite-plugin-universal -api )
12+ ![ npm bundle size] ( https://img.shields.io/bundlephobia/minzip/%40ndriadev%2Fvite-plugin-universal -api?style=for-the-badge&label=SIZE&color=yellow )
13+ [ ![ npm downloads] ( https://img.shields.io/npm/dt/%40ndriadev/vite-plugin-universal- api?label=DOWNLOADS&style=for-the-badge&color=red )] ( https://www.npmjs.com/package/%40ndriadev/vite-plugin-universal -api )
1414[ ![ License: MIT] ( https://img.shields.io/badge/LICENSE-MIT-blue.svg?style=for-the-badge )] ( https://opensource.org/licenses/MIT )
1515
1616![ Statements] ( https://img.shields.io/badge/statements-100%25-brightgreen.svg?style=for-the-badge )
5858
5959## 🎯 Overview
6060
61- ** vite-plugin-ws-rest-fs -api** is a comprehensive Vite plugin that transforms your development server into a powerful mock backend. It provides three complementary approaches to handle API requests:
61+ ** vite-plugin-universal -api** is a comprehensive Vite plugin that transforms your development server into a powerful mock backend. It provides three complementary approaches to handle API requests:
6262
63631 . ** 📁 File-System Based API** - Automatically serve mock data from your file system
64642 . ** 🔄 REST API Handlers** - Define custom programmatic handlers for dynamic responses
@@ -117,13 +117,13 @@ Perfect for frontend developers who need to:
117117
118118``` bash
119119# pnpm (recommended)
120- pnpm add -D @ndriadev/vite-plugin-ws-rest-fs -api
120+ pnpm add -D @ndriadev/vite-plugin-universal -api
121121
122122# npm
123- npm install -D @ndriadev/vite-plugin-ws-rest-fs -api
123+ npm install -D @ndriadev/vite-plugin-universal -api
124124
125125# yarn
126- yarn add -D @ndriadev/vite-plugin-ws-rest-fs -api
126+ yarn add -D @ndriadev/vite-plugin-universal -api
127127```
128128
129129### Requirements
@@ -140,7 +140,7 @@ yarn add -D @ndriadev/vite-plugin-ws-rest-fs-api
140140``` typescript
141141// vite.config.ts
142142import { defineConfig } from ' vite' ;
143- import mockApi from ' @ndriadev/vite-plugin-ws-rest-fs -api' ;
143+ import mockApi from ' @ndriadev/vite-plugin-universal -api' ;
144144
145145export default defineConfig ({
146146 plugins: [
@@ -175,7 +175,7 @@ curl http://localhost:5173/api/users
175175### Basic Options
176176
177177``` typescript
178- interface ApiWsRestFsOptions {
178+ interface UniversalApiOptions {
179179 /**
180180 * Disable the entire plugin
181181 * @default false
@@ -300,7 +300,7 @@ interface RestHandler {
300300 /**
301301 * Handler function or 'FS' for file-system routing
302302 */
303- handle: ' FS' | ((req : ApiWsRestFsRequest , res : ServerResponse ) => void | Promise <void >);
303+ handle: ' FS' | ((req : UniversalApiRequest , res : ServerResponse ) => void | Promise <void >);
304304
305305 /**
306306 * Disable this specific handler
@@ -317,7 +317,7 @@ interface RestHandler {
317317 * For 'FS' handlers: function called before reading the file
318318 * Can modify path, check permissions, etc.
319319 */
320- preHandle? : (req : ApiWsRestFsRequest , res : ServerResponse ) => {
320+ preHandle? : (req : UniversalApiRequest , res : ServerResponse ) => {
321321 continueHandle: boolean ;
322322 path? : string ;
323323 } | Promise <{... }>;
@@ -326,7 +326,7 @@ interface RestHandler {
326326 * For 'FS' handlers: function called after reading the file
327327 * Can transform data, add headers, etc.
328328 */
329- postHandle? : (req : ApiWsRestFsRequest , res : ServerResponse , data : any ) => {
329+ postHandle? : (req : UniversalApiRequest , res : ServerResponse , data : any ) => {
330330 continueHandle: boolean ;
331331 data? : any ;
332332 } | Promise <{... }>;
@@ -1171,12 +1171,12 @@ handlers: [
11711171
11721172## 📚 API Reference
11731173
1174- ### Request Object (ApiWsRestFsRequest )
1174+ ### Request Object (UniversalApiRequest )
11751175
11761176Extended ` IncomingMessage ` with additional properties:
11771177
11781178``` typescript
1179- interface ApiWsRestFsRequest extends IncomingMessage {
1179+ interface UniversalApiRequest extends IncomingMessage {
11801180 /** Parsed request body (JSON, form data, etc.) */
11811181 body: any ;
11821182
@@ -1554,7 +1554,7 @@ Response sent
15541554
15551555``` typescript
15561556type MiddlewareFunction = (
1557- req : ApiWsRestFsRequest ,
1557+ req : UniversalApiRequest ,
15581558 res : ServerResponse ,
15591559 next : () => void
15601560) => void | Promise <void >;
@@ -1573,7 +1573,7 @@ Example use cases:
15731573``` typescript
15741574type ErrorHandlerFunction = (
15751575 err : any ,
1576- req : ApiWsRestFsRequest | IncomingMessage ,
1576+ req : UniversalApiRequest | IncomingMessage ,
15771577 res : ServerResponse ,
15781578 next : (err ? : any ) => void
15791579) => void | Promise <void >;
@@ -2070,8 +2070,8 @@ This will log:
20702070
20712071## 📞 Support
20722072
2073- - ** Issues:** [ GitHub Issues] ( https://github.com/nDriaDev/vite-plugin-ws-rest-fs -api/issues )
2074- - ** Discussions:** [ GitHub Discussions] ( https://github.com/nDriaDev/vite-plugin-ws-rest-fs -api/discussions )
2073+ - ** Issues:** [ GitHub Issues] ( https://github.com/nDriaDev/vite-plugin-universal -api/issues )
2074+ - ** Discussions:** [ GitHub Discussions] ( https://github.com/nDriaDev/vite-plugin-universal -api/discussions )
20752075- ** Email:** info@ndria.dev
20762076
20772077---
@@ -2081,6 +2081,6 @@ This will log:
20812081<div align =" center " >
20822082
20832083
2084- If you find this plugin useful, please consider giving it a ⭐ on [ GitHub] ( https://github.com/nDriaDev/vite-plugin-ws-rest-fs -api ) !
2084+ If you find this plugin useful, please consider giving it a ⭐ on [ GitHub] ( https://github.com/nDriaDev/vite-plugin-universal -api ) !
20852085
20862086</div >
0 commit comments