Narae.js / Eco System / webserver-serverless Edit this page

webserver-serverless

Installation

$ npm install --save @naraejs/webserver-serverless

Basic Code

import * as naraejs from '@naraejs/core';
import * as webserverExpress from '@naraejs/webserver-express';
import * as webserverServerless from '@naraejs/webserver-serverless';

naraejs.install(webserverExpress);
naraejs.install(webserverServerless);

/**
 * YOU MUST CALL createHandler BEFORE narae.js START
 */
const app = naraejs.create();
const handler = webserverServerless.createHandler(app, webserverServerless.ServerlessPlatform.KUBELESS);

app.start();

export {
  handler
};

Supported Serverless Platforms

Auto

const handler = webserverServerless.createHandler(app, webserverServerless.ServerlessPlatform.AUTO);
  • AWS Lambda : LAMBDA_TASK_ROOT Environment가 있는지 확인합니다.
  • Kubeless : KUBELESS_INSTALL_VOLUME Environment가 있는지 확인합니다.

Kubeless

const handler = webserverServerless.createHandler(app, webserverServerless.ServerlessPlatform.KUBELESS);

AWS Lambda

NOT TESTED

const handler = webserverServerless.createHandler(app, webserverServerless.ServerlessPlatform.AWS_LAMBDA);