0.1.1 • Published 9 months ago

aircode-modular v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

AirCode Modular

Compile cloud functions to ES Modules.

Usage

// index.mjs
import {getContext, modular} from 'aircode-modular';

function add(x, y) {
  return x + y;
}

function getUrl(context) {
  const {url} = context;
  return url;
}

export default modular({
  add,
  getUrl,
});

Assuming the deployed cloud function URL is: https://au215ybu51.us.aircode.run/index

You can write client-side code in the following way:

import {add, getUrl} from 'https://au215ybu51.us.aircode.run/index';

console.log(await add(1, 2)); // => 3
console.log(await getUrl()); // => /index
0.1.1

9 months ago

0.1.0

9 months ago