Skip to content

darkotodoric/fake-rest-api

Repository files navigation

Fake REST API for testing

This project provides a simple, fake REST API using Symfony for testing purposes. It's designed to simulate basic user-related operations such as fetching user details, creating a new user, and deleting a user. The data is stored in a JSON file, making it lightweight and easy to manipulate.

Installation

To set up this project, follow these steps:

  1. Clone the repository:
git clone https://github.com/darkotodoric/fake-rest-api
  1. Start the Docker
docker-compose up -d
  1. Install dependencies:
docker exec -it fakerestapi-php-container php composer.phar install
  1. Start using API
curl -X GET "http://localhost:1337/users"

Usage

The API provides the following endpoints:

  • GET /users: List all users.
  • POST /users: Create a new user.
  • GET /users/{id}: Get details of a user by their ID.
  • DELETE /users/{id}: Delete a user by their ID.
  • GET /headers: List of headers

Data Structure

The user data is stored in data/users.json. Each user object typically contains the following fields:

  • id: Unique identifier for the user.
  • first_name: First name of the user.
  • last_name: Last name of the user.
  • username: Username of the user.
  • email: Email address of the user.
  • (Other fields as required).

About

Fake REST API for testing

Topics

Resources

License

Stars

Watchers

Forks