npx json-server db.json --static ./public

Category: Web App Development

npx json-server db.json --static ./public

Serve static files alongside the mock API

Serves the public folder as static assets on the same origin as the fake REST API, so the frontend and API share a port. The --static flag sets that directory. Combined with --port you get a complete local app.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.