A Todo-Backend implementation in OpenWhisk PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Todo-Backend for OpenWhisk PHP

This is an OpenWhisk API written in PHP that implements Todo-Backend.

It uses Pimple for dependency injection and Fractal for the presentation layer. The data is stored in (PostgreSQL](https://www.postgresql.org) hosted by ElephantSQL via PDO.

Set up

  1. Ensure you have an an IBM Cloud account to deploy to their OpenWhisk service (called Functions)

  2. Set up the bx command line tool and set your workspace.

  3. Set up a (free) ElephantSQL service in your IBM Cloud and bind the credentials to an OpenWhisk package called "todo-backend":

    $ bx service create elephantsql turtle bookshelf-db
    $ bx service key-create bookshelf-db key1
    $ bx wsk package create todo-backend
    $ bx wsk service bind elephantsql --instance bookshelf-db todo-backend
  4. Install the Serverless Framework

    $ npm install --global serverless serverless-openwhisk
  5. Clone this repo

  6. Run the package managers:

    $ npm install
    $ composer install
  7. Deploy the API using the sls command:

    $ sls deploy

    Take a note of the URL to the "list-todos" endpoint in the "endpoints (api-gw)" section as we'll need it later.

  8. Create the database table

    $ sls invoke -f create-schema

Your API is now up and running.

Running the test

Visit the TodoBacked test suite and enter the list-todos endpoint from the endpoints (api-gw) section when you ran sls deploy. You can run sls info to view it again.

Press the Run tests button.

Screen shot of successful test run