npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@h4ad/serverless-adapter

v4.2.1

Published

Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Digital Ocean and many other clouds.

Downloads

3,699

Readme

npm package Build Status Downloads Issues Code Coverage Commitizen Friendly

Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Deepkit, Express, Koa, Hapi, Fastify, tRPC and Apollo Server), on top of AWS Lambda, Azure, Digital Ocean and many other clouds.

This library was a refactored version of @vendia/serverless-express, I create a new way to interact and extend event sources by creating contracts to abstract the integrations between each library layer.

Why you would use this libray instead of @vendia/serverless-express?

  • Better APIs to extend library functionality.
    • You don't need me to release a new version to integrate with the new event source, you can create an adapter and just call the addAdapter method when building your handler.
  • All code can be extended, if you want to modify the current behavior you can.
    • This is important because if you find a bug, you can quickly resolve it by extending the class, and then you can submit a PR to fix the bug.
  • All code was written in Typescript.
  • Well documented, any method, class, or interface has comments to explain the behavior.
  • We have >99% coverage.

Installing

To be able to use, first install the library:

npm i --save @h4ad/serverless-adapter

Usage

To start to use, first you need to know what you need to import, let's start showing the ServerlessAdapter.

import { ServerlessAdapter } from '@h4ad/serverless-adapter';

We need to pass to Serverless Adapter the instance of your api, let's look an example with:

import { ServerlessAdapter } from '@h4ad/serverless-adapter';
import { ExpressFramework } from '@h4ad/serverless-adapter/lib/frameworks/express';
import { DefaultHandler } from '@h4ad/serverless-adapter/lib/handlers/default';
import { PromiseResolver } from '@h4ad/serverless-adapter/lib/resolvers/promise';
import { ApiGatewayV2Adapter } from '@h4ad/serverless-adapter/lib/adapters/aws';

const express = require('express');

const app = express();
export const handler = ServerlessAdapter.new(app)
  .setFramework(new ExpressFramework())
  .setHandler(new DefaultHandler())
  .setResolver(new PromiseResolver())
  .addAdapter(new ApiGatewayV2Adapter())
  // if you need more adapters
  // just append more `addAdapter` calls
  .build();

Documentation

See how to use this library here.

Breaking Changes

I will not consider updating/breaking compatibility of a NodeJS framework as a breaking change, because I had a lot of supported frameworks and if I created a major version for each one it would be a mess.

So if you want predictability, pin the version with ~ instead of ^.

Examples

You can see some examples of how to use this library here.

Benchmark

See the speed comparison between other libraries that have the same purpose in the Benchmark Section.

Credits

Honestly, I just refactored all the code that the @vendia team and many other contributors wrote, thanks so much to them for existing and giving us a brilliant library that is the core of my current company.

Sponsors

| | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|