Skip to content

michaelrambeau/bestofjs-microservices

Repository files navigation

Bestof.js.org micro-services with webtask.io

node.js micro-services used by bestof.js.org web application.

Each micro-service is either a plain JavaScript function either a basic Express web server deployed on webtask.io.

Build Status

How to create your first micro-service with webtask.io

Requirement: sign up to webtask.io (using your Github account for example).

STEP 1. Create a basic JavaScript file with a callback that returns a JSON object.

module.exports = function (cb) {
  var json = {
    status: 'OK'
  };
  cb(null, json);
};

STEP 2. Install the command line tool

npm install wt-cli -g

STEP 3. Login from the command line

wt init ****r@gmail.com

STEP 4. Check your email and enter the verification number (6 digits).

STEP 5. Create the webtask, from the local JavaScript file.

wt create index.js

=> an URL is generated to launch the webtask!

curl https://webtask.it.auth0.com/api/run/wt-mikeair-gmail_com-0/index
?webtask_no_cache=1

The microservices I did

Each folder contains the code for a given micro-service.

  • get-github-readme: return a formatted README.md for a given Github project
  • user-content-api: REST API used to create/edit content generated by users (reviews and links)

There are at least 2 JavaScript files in each folder:

  • <micro-service-name>.js the code of the micro-service uploaded to webtask.io
  • index.js (or index.coffee) used to run the service locally, from the command line.

About

node.js micro-services used by bestof.js.org web application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors