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.
Ensure you have an an IBM Cloud account to deploy to their OpenWhisk service (called Functions)
Set up the bx
command line tool and set your workspace.
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
Install the Serverless Framework
$ npm install --global serverless serverless-openwhisk
Clone this repo
Run the package managers:
$ npm install
$ composer install
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.
Create the database table
$ sls invoke -f create-schema
Your API is now up and running.
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.