🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

http-for-serverless

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

http-for-serverless

HTTP tools for Serverless

unpublished
latest
Source
npmnpm
Version
0.0.6
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

HTTP tools for Serverless

Express-like helper for Lambda http events.

A WORK IN PROGRESS

Inspired by Express and https://github.com/dougmoscrop/serverless-http.

Examples

JSON

var http = require('http-for-serverless');

module.exports.endpoint = http((req, req) => {
  res.json({
    message: `Hello, the current time is ${new Date().toTimeString()}.`,
  });
});

HTML

var http = require('http-for-serverless');

module.exports.endpoint = http((req, req) => {
  res.send(`
    <!DOCTYPE html>
    <html>
      <head>
        <title>http-for-serverless</title>
      </head>
      <body>
        <p>Hello, the current time is ${new Date().toTimeString()}.</p>
      </body>
    </html>`);
});

React

react & react-dom are required

var http = require('http-for-serverless');
var View = require('./views/View');

module.exports.endpoint = http((req, req) => {
  // <DOCTYPE html> is automatically prepended to the rendered component
  // if the output begins with "<html"
  res.render(View, {
    time: new Date().toTimeString()
  });
});

FAQs

Package last updated on 16 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts