Skip to content

Example microservices application using the Slim framework to talk JSON API.

License

Notifications You must be signed in to change notification settings

jpklein/slim-json-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON API code sample.

Able to:

  • Retrieve movie data given a unique ID
  • Submit movie rating per user
  • Retrieve overall movie rating based on all users' ratings

Implements the following JSON API endpoints:

  • /movies/{movie_id}
  • /movieratings/{movie_id}
  • /usermovieratings/{user_id}/movies/{movie_id}

Note that per the JSON API specification, all requests must contain the Content-Type: application/vnd.api+json header

To test:

  1. Ensure you have PHP >7.0 installed and MySQL server >5.7 running (eg: mysql.server start)
  2. Clone the contents of this respository to the test environment
  3. Install the Slim framework and PHPUnit dependencies with Composer
    > cd slim-json-api
    > php composer.phar install
    
  4. Update MySQL connection settings in /config/default.php if necessary
  5. Install the testing database
    > php app.php install stage
    
  6. Start PHP's built-in application server
    > php -S 127.0.0.1:8080 -t public
    
  7. Open a new terminal session in the project folder and run the test suite
    > cd slim-json-api
    > php vendor/bin/phpunit
    

About

Example microservices application using the Slim framework to talk JSON API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages