Article API with Webtask for Android. Webtasks is a simple, lightweight, and secure way of running isolated backend code that removed or reduces the need for a backend.
You need all this get started
- Android Studio 3.0+
- RxJava
- Knowledge of MVVM
- Dagger
- Retrofit
Firstly your need to install the command line tool with the following command. This will get all you need set.
$ npm i -g wt-cli
$ wt init
To test if it working. Create hello.js
file and add this functions
module.exports = function (done) {
done(null, ‘Hello!’);
}
The simply create a function on the webtask server that returns Hello! when the function is triggered. Just run
$ wt create hello.js
This will return a URL on your terminal . Test the URL with your browser any console of your choice.
Your can test this endpoint on Postman or any other console
Add new articles by passed a body with following fields title, content, imageurl, author
POST https://wt-e681794554391ac97c69e1539e0c67df-0.run.webtask.io/article-api/articles
Fetch all articles
GET https://wt-e681794554391ac97c69e1539e0c67df-0.run.webtask.io/article-api/articles
Update a article with an {id}
PUT https://wt-e681794554391ac97c69e1539e0c67df-0.run.webtask.io/article-api/articles
Delete article with an {id}
DELETE https://wt-e681794554391ac97c69e1539e0c67df-0.run.webtask.io/article-api/articles
We will now deploy our webtask functions. MONGOLAB-CONNECTION-URL
should be replaced with your Mongolab DB URL.
wt create index --secret MONGO_URL=<MONGOLAB-CONNECTION-URL> --bundle
This project is licensed under the MIT License - see the LICENSE.md file for details
- Codebeast