0.8.0 • Published 4 years ago

serverless-form-parser v0.8.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

serverless-form-parser

Form and file upload parser for serverless environments 🌋

Install

npm i serverless-form-parser

HTTP usage

import http from "http"
import parser from "serverless-form-parser"

const port = 4000

http
  .createServer(async (req, res) => {
    const { files, params } = await parser.fromHttpRequest(
      req
    )
    res.end(JSON.stringify(params))
  })
  .listen(4000)

API Gateway usage

import {
  APIGatewayProxyEvent,
  APIGatewayProxyResult,
} from "aws-lambda"

import parser from "serverless-form-parser"

export async function lambda(
  event: APIGatewayProxyEvent
): Promise<APIGatewayProxyResult> {
  const { files, params } = await parser.fromApiGateway(
    event
  )
  return { body: JSON.stringify(params) }
}
0.8.0

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago