Todo-Backend for OpenWhisk PHP
Ensure you have an an IBM Cloud account to deploy to their OpenWhisk service (called Functions)
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 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.
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.