Visitar URL original
API Mom — mock REST API for users and movies with CORS and pagination | Subrahmanyam Poluru

Backend · Demo

API Mom

A mock REST API for users and movies, with CORS, pagination, and a live request console.

Category
Backend
Status
Demo
Stack
PHP, REST, JSON
API Mom preview

Overview

API Mom is a PHP mock backend for frontend work. It is not a production service. It exposes REST endpoints for users and movies, always as JSON, with CORS headers so a local React or other SPA can call it without a proxy.

The users API covers list, get-by-id, create, update, and delete. List calls accept page and limit (default 10, max 100). Each user has name, email, phone, nested address, company, website, and timestamps.

The movies API adds catalog behavior: twelve sample titles, twelve categories, search across title/description/director/cast, filters (category, year, rating, IMDB score, featured), and sort (title, year, score, duration, box office). HTML consoles — unified-demo, users demo, and movies demo — let you fire requests without a REST client.

Features

  • REST users. GET/POST /api/users and GET/PUT/DELETE /api/users/{id} with validation and error payloads.
  • REST movies and categories. Full movie CRUD plus GET /api/categories and GET /api/categories/{id} with movie counts.
  • Pagination. page and limit on collection endpoints, with total and total_pages in the users list response.
  • Movie search and filters. Query params for category, year, rating, min_score, featured, search, sort, and order.
  • CORS and JSON. Cross-origin requests enabled; responses are JSON with standard HTTP status codes.
  • Request consoles. unified-demo.html, demo.html, and movies-demo.html to exercise endpoints in the browser.

Technologies

Backend

  • PHP
  • REST
  • JSON responses
  • CORS headers
  • Input validation

Resources

  • Users mock data
  • Movies catalog
  • Category index
  • Pagination metadata

Demos

  • unified-demo.html
  • demo.html (users)
  • movies-demo.html
  • router.php

Pages

Routes below are the screens in the live demo. Open the app in a new tab and append a path after the demo URL.

RoutePageWhat it doesAccess
/Unified consoleDefault route that opens the unified request console.Public
/unified-demo.htmlUnified console fileDirect file route for users and movies in one page.Public
/demo.htmlUsers demoConsole focused on the users resource.Public
/movies-demo.htmlMovies demoConsole focused on movies and categories.Public

API endpoints

Collection endpoints support page and limitwhere applicable. Resource-specific filters and sorting are listed below by endpoint.

MethodEndpointWhat it does
GET/api/usersList users with page and limit.
GET/api/users/{id}Fetch one user.
POST/api/usersCreate a user.
PUT/api/users/{id}Update a user.
DELETE/api/users/{id}Delete a user.
GET/api/moviesList movies with search, filters, sort, and pagination.
GET/api/movies/{id}Fetch one movie.
POST/api/moviesCreate a movie.
PUT/api/movies/{id}Update a movie.
DELETE/api/movies/{id}Delete a movie.
GET/api/categoriesList categories with movie counts.
GET/api/categories/{id}Fetch one category and its count.