Package Exports
- @viq/functions
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@viq/functions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Cloud Functions | viq.app
Package to create and use viq.app cloud functions
Installation
In your project directory run:
# using yarn
$ yarn add @viq/functions
# using npm
$ npm install @viq/functionsUsage
const functions = require('@viq/functions');
// Express-style request accepting all HTTP methods
functions.path('/helloWorld').onReq((req, res) => {
res.send('Hello world');
});
// Adding middleware
const someMiddleware = (req, res, next) => {
req.foo = 'bar';
};
functions
.path('/foo')
.mid(someMiddleware)
.onReq((req, res) => {
res.send(req.foo); // => 'bar'
});
module.exports = functions;