Skip to content

Nsikaktopdown/ArticleApi-webtask-Android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ArticleApi-webtask-Android

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.

Article Android App

Prerequisites

You need all this get started

  1. Android Studio 3.0+
  2. RxJava
  3. Knowledge of MVVM
  4. Dagger
  5. Retrofit

Setting up Webtask

Webtask

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.

Webtask test

Testing the API

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

Deploying your APP

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

Payload for Postman

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Codebeast

About

Article API with Webtask for Android

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published