Lolo/HTTP Multi-Trigger

Set up a HTTP Trigger with Multiple HTTP Methods

This library function lets you set up a multi-method HTTP trigger with the option of adding auth and a JSON schema. It requires you to send back an emit('response') to successfully respond the HTTP request.

Once you have saved and deployed you will be able to see your endpoints in the Docs of your application.

Simple Usage

Simply specify your path name under Parameters in the library function and then remove ports if you want to remove certain actions.

To send back a response use the same emit('response') method in the connecting node as you do with a simple HTTP trigger.

exports.handler = async(ev, ctx) => {
  const { emit } = ctx;

  // Emit response
  emit('response', { statusCode: '200', ev });

Adding a JSON Schema

You may also add in a JSON schema validator that will validate the body of the request for POST, PUT and PATCH. Example JSON schema with name as required and age as optional.

    "type": "object",
    "properties": {
        "name": {
            "type": "string",
            "description": "user name"
        "age": {
            "type": "integer"
    "required": [

Use this JSON schema builder tool for help.

Adding Authentication

Additionally, you may add in authentication and authorization to keep the endpoints private. This library function uses Lolo Authentication which requires a user to provide a valid API key connected to their Lolo account to be granted access. When adding Authentication here you will need to provide a Lolo-Api-Key in the header to access the endpoints.

const options = {
    headers: {
      'Lolo-Api-Key': "your key here",

Do remember that anyone with a Lolo account may access this if you don't specify the Lolo accounts that should be granted access.

Adding Authorization

If you've added Lolo Auth then you can specify which Lolo accounts should have access to these endpoints. Add in the email/s of the Lolo account/s that should be granted access. The library function extracts user data coming from the API key and checks it against the email you provide here. If none are specified, all Lolo users with a valid API key will be able granted access. Read more about Lolo Authentication here, although not necessary to use this.

Once you have saved and deployed you can see your endpoints under Docs in the application. Use Postman to test the endpoints if you have added auth.

Youtube Video Tutorial

If you want to follow us demonstrating this library function via a tutorial see the video below.