@vivid-front/fake-api
v1.5.5
Published
A Node.js library for creating fake APIs from file structure.
Maintainers
Readme
@vivid-front/fake-api
Create a simple fake API from your filesystem structure. Includes a CLI and runtime to spin up an Express server and map routes from files.
What it is
- A development-time server to mock backend endpoints.
- Reads configuration from vivid-front.config.* in your project root.
- Supports collections loading and dynamic route mapping.
Install
- npm: npm install -D @vivid-front/fake-api
- yarn: yarn add -D @vivid-front/fake-api
- pnpm: pnpm add -D @vivid-front/fake-api
CLI
- After installing, use the CLI:
npx fake-apiBasic usage (programmatic)
import { initialize, start } from '@vivid-front/fake-api';
await initialize();
start();Configuration
- vivid-front.config.(js|cjs|mjs|ts|cts) exported object includes:
- port: number
- apiDir: string
- collectionsDir: string
- wildcardChar: string
- routeFileExtension?: 'js' | 'ts'
- http?: { endpoints: Record<string, Record<string, { baseUrl: string; headers?: Record<string,string> }>> }
Node support
- Node >= 22.18.0
License MIT
