npm.io
1.1.5 • Published 7 years agoCLI

nanofunction

Licence
ISC
Version
1.1.5
Deps
5
Size
3 kB
Vulns
0
Weekly
0
Stars
2

NanoFunction

Introduction

Asynchronous HTTP microservices using function based architecture.

Code Samples

Create an index.js file and export a function that accepts the standard http.IncomingMessage and http.ServerResponse objects:

module.exports = (req, res) => {
  res.json({
    data: {
      handle: "@mkhizeryounas"
    }
  });
};

Installation

npm install nanofunction --save

Next, ensure that the main property inside package.json points to your microservice (which is inside index.js in this example case) and add a start script:

{
  "main": "index.js",
  "scripts": {
    "start": "nanofunction index.js"
  }
}

Keywords