Skip to content

This library enables you to utilize Tencent Cloud API Gateway to respond to web and API requests using your existing Node.js application framework.

License

Notifications You must be signed in to change notification settings

serverless-plus/tencent-serverless-http

Repository files navigation

Tencent Serverless Http

Build Status npm npm dependencies Status

This project is a fork of aws-serverless-express, and modify for tencent cloud scf.

Install

npm install tencent-serverless-http

Usage

// handler.js
'use strict';
const tencentServerlessHttp = require('tencent-serverless-http');
const app = require('./app');
const server = tencentServerlessHttp.createServer(app);

exports.handler = (event, context) => {
  tencentServerlessHttp.proxy(server, event, context);
};

This package includes middleware to easily get the event object Lambda receives from API Gateway

const tencentServerlessHttpMiddleware = require('tencent-serverless-http/middleware');
app.use(tencentServerlessHttpMiddleware.eventContext());
app.get('/', (req, res) => {
  res.json(req.apiGateway.event);
});

About

This library enables you to utilize Tencent Cloud API Gateway to respond to web and API requests using your existing Node.js application framework.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •