luckystarry-alifc-utils
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

luckystarry-alifc-utils

一个为阿里云函数计算提供的容器服务,配合 luckystarry-ui 框架使用。

Build Status Build Test Coverage Status Npm Status install size codebeat badge Known Vulnerabilities License Status

Install

npm i -S luckystarry-alifc-utils

Usage

简单的使用如下所示:

// index.js
const alifc = require('luckystarry-alifc-utils')

// 注册处理方法
let handler = alifc.default.register(async (context, utils) => {
  // 登陆保护,需要 headers 中包含 x-jwt-profile 及 x-jwt-sub 使用。头部内容可由阿里云API网关的JWT插件负责填充。
  utils.ensureLogin().getOrThrow()
  return utils.ok()
})

// 导出(由于FC框架的this指针存在风险,建议使用闭包方式绑定。)
module.exports.handler = (event, context, callback) => handler.handle(event, context, callback)

LICENSE

MIT License

Copyright (c) 2020 SUN BO

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i luckystarry-alifc-utils

Weekly Downloads

20

Version

0.1.2

License

ISC

Unpacked Size

93.5 kB

Total Files

141

Last publish

Collaborators

  • luckystarry