This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@lagon/runtime
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

Lagon

JavaScript Serverless Runtime

API

const deployment: Deployment = {
  functionId: 'custom-id',
  deploymentId: 'custom-id',
  domains: ['localhost:3000'],
  memory: 128,
  timeout: 50,
  env: {
    hello: 'world',
  },
  isCurrent: true,
}

function getDeploymentCode(deployment) {
  return `export async function handler(request) {
    return new Response("Hello world!")
  }`
}

const runIsolate = await getIsolate({
  deployment,
  getDeploymentCode,
})

const request: HandlerRequest  = {
  input: '/test',
  options: {
    method: 'GET',
    headers: {},
    body: 'request body',
  },
}

const { response } = await runIsolate(request)

Runtime

Request

new Request(input [, options])

Constructor

  • input: string
  • options?: RequestInit
RequestInit
  • method?: string
  • headers?: Record<string, string | string[] | undefined>
  • body?: string

Properties

  • method: string
  • headers: Record<string, string | string[] | undefined>
  • body: string
  • url: string

Methods

  • text(): Promise<string>
  • json<T>(): Promise<T>
  • formData(): Promise<Record<string, string>>

Response

new Response(body [, options])

Constructor

  • body: string
  • options?: ResponseInit
ResponseInit
  • status?: string
  • statusText?: string
  • headers?: Record<string, string | string[] | undefined>
  • url?: string

Properties

  • body: string
  • headers: Record<string, string | string[] | undefined>
  • ok: boolean
  • status: number
  • statusText: string
  • url: string

Methods

  • text(): Promise<string>
  • json<T>(): Promise<T>
  • formData(): Promise<Record<string, string>>

Fetch

fetch(resource [, init]): Promise<Response>

Parameters

  • resource: string
  • init?: RequestInit

Environment variables

MY_VARIABLE

Console

console.log(...args: any[])
console.error(...args: any[])
console.info(...args: any[])
console.warn(...args: any[])
console.debug(...args: any[])

Readme

Keywords

none

Package Sidebar

Install

npm i @lagon/runtime

Weekly Downloads

0

Version

0.0.6

License

none

Unpacked Size

52.8 kB

Total Files

5

Last publish

Collaborators

  • matt.straka
  • quiibz