Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@serverless/components

Package Overview
Dependencies
Maintainers
6
Versions
516
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serverless/components

The Serverless Framework's new infrastructure provisioning technology — Build, compose, & deploy serverless apps in seconds...

  • 3.18.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
111K
increased by14.84%
Maintainers
6
Weekly downloads
 
Created

What is @serverless/components?

@serverless/components is a framework for building and deploying serverless applications using reusable components. It simplifies the process of managing serverless infrastructure by providing pre-built components that can be easily configured and deployed.

What are @serverless/components's main functionalities?

Deploying a Serverless Function

This code demonstrates how to deploy an AWS Lambda function using the @serverless/components package. The function is defined with a name, handler, and code directory.

const { Component } = require('@serverless/components');

class MyFunction extends Component {
  async default(inputs = {}) {
    const function = await this.load('@serverless/aws-lambda');
    const output = await function({
      name: 'my-function',
      handler: 'index.handler',
      code: './code'
    });
    return output;
  }
}

module.exports = MyFunction;

Deploying a Serverless API

This code demonstrates how to deploy an API Gateway with a single GET endpoint using the @serverless/components package. The API is configured with a name and routes.

const { Component } = require('@serverless/components');

class MyApi extends Component {
  async default(inputs = {}) {
    const api = await this.load('@serverless/aws-api-gateway');
    const output = await api({
      name: 'my-api',
      routes: {
        '/': {
          get: 'my-function'
        }
      }
    });
    return output;
  }
}

module.exports = MyApi;

Deploying a Static Website

This code demonstrates how to deploy a static website to an S3 bucket using the @serverless/components package. The website is defined with a name and code directory.

const { Component } = require('@serverless/components');

class MyWebsite extends Component {
  async default(inputs = {}) {
    const website = await this.load('@serverless/aws-s3-website');
    const output = await website({
      name: 'my-website',
      code: './website'
    });
    return output;
  }
}

module.exports = MyWebsite;

Other packages similar to @serverless/components

FAQs

Package last updated on 19 Jan 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc