@slsplus/core
v1.1.8
Published
Serverless Plus Components
Downloads
2
Readme
Serverless Plus Components Core
Thanks to serverless/components.
Build, compose, & deploy serverless apps in seconds with Serverless Components, the Serverless Framework's new infrastructure provisioning technology.
- [x] Speed - The fastest way to deploy serverless infra and apps.
- [x] Power - Deploy low-level infra, or higher-order use-case abstractions.
- [x] Re-Use - Everything you build is reusable by you, your team, and (if you want) the world.
- [x] Composition - Easily compose Components together in YAML or Javascript.
Here's how easy it is to use Components with Serverless Framework:
# serverless.yml
name: website
website:
component: '@serverless/tencent-website'
inputs:
code:
src: ./src
hook: npm run build
Quick-Start
Install the Serverless Plus via NPM:
$ npm i -g slsplus
部署 Serverless 全栈 WEB 应用(React.js)
本示例以 React 为前端,Express 框架作为后端,通过多个 Serverless Components 部署 Serverless 全栈应用程序。
$ slsplus create --template-url https://github.com/serverless-plus/components/tree/master/templates/tencent-fullstack-react-application
Reusability
While Serverless Components can be easily composed in YAML (serverless.yml
), they are written as reusable javascript libraries (serverless.js
), with simple syntax inspired by component-based frameworks, like React.
// serverless.js
const { Component } = require('@serverless/core')
class MyBlog extends Component {
async default(inputs) {
this.context.status('Deploying a serverless blog')
const website = await this.load('@serverless/tencent-website') // Load a component
const outputs = await website({ code: { src: './blog-code' } }) // Deploy it
this.state.url = outputs.url
await this.save()
return outputs
}
}
module.exports = MyBlog
Anyone can build a Serverless Component and share it in our upcoming Registry.