/car-gallery-api

Simple CRUD API using Slim Framework

Primary LanguagePHP

Car Gallery API

Requirements

  • Web server with URL rewriting
  • PHP 7 or latest
  • PostgreSQL 10.4 or latest
  • Composer
  • Git

Installation

  • Clone this repository using git
git clone git@github.com:andhikayuana/car-gallery-api.git
  • Install depdendencies using composer
$ cd car-gallery-api
$ composer install

Runninng

To run this API using this command

cd public
php -S localhost:3000

Access localhost:3000 using postman or your web browser

and now you can see like this

{
  "name": "Cars API",
  "version": "1.0.0"
}

How to use this API

[GET] /cars | get all cars
[GET] /cars/{id} | get cars by id
[POST] /cars | insert cars
body [raw] :
{
    "year": "2011",
    "make": "honda",
    "model": "mobilio"
}
[PUT] /cars/{id} | update cars
body [raw] :
{
    "year": "2015",
    "make": "halo",
    "model": "world"
}
[DELETE] /cars/{id} | delete by id