diff --git a/.gitignore b/.gitignore index 0e6d4f68a..0f6aedb11 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ .s node_modules package-lock.json -./index.py \ No newline at end of file +./index.py +.vscode \ No newline at end of file diff --git a/update.list b/update.list index 95e8aa2b9..c64643ab4 100755 --- a/update.list +++ b/update.list @@ -1 +1 @@ -web-framework/python/webpy \ No newline at end of file +web-framework/nodejs/custom-runtime/nest \ No newline at end of file diff --git a/web-framework/nodejs/custom-runtime/nest/hook/index.js b/web-framework/nodejs/custom-runtime/nest/hook/index.js new file mode 100644 index 000000000..67a07ae9b --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/hook/index.js @@ -0,0 +1,24 @@ +async function preInit(inputObj) { + console.log(` + Serverless Devs Application Case + + Cloud services required: + - FC : https://fc.console.aliyun.com/ + + Tips: + - FC Component: https://www.serverless-devs.com/fc/readme`) + +} + +async function postInit(inputObj) { + console.log(` + * Before using, please check whether the actions command in Yaml file is available + * Carefully reading the notes in s.yaml is helpful for the use of the tool + * If need help in the use process, please apply to join the Dingtalk Group: 33947367 + `) +} + +module.exports = { + postInit, + preInit +} \ No newline at end of file diff --git a/web-framework/nodejs/custom-runtime/nest/publish.yaml b/web-framework/nodejs/custom-runtime/nest/publish.yaml new file mode 100755 index 000000000..da4091f66 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/publish.yaml @@ -0,0 +1,58 @@ +Type: Application +Name: start-nest +Version: 0.0.1 +Provider: + - 阿里云 +Description: Nest (NestJS) 是一个用于构建高效、可扩展的 Node.js 服务器端应用程序的开发框架。 +HomePage: https://github.com/devsapp/start-web-framework +Tags: + - nest + - 云应用 +Category: 基础云服务 +Service: + 函数计算: + Authorities: + - AliyunFCFullAccess +Parameters: + type: object + additionalProperties: false # 不允许增加其他属性 + required: # 必填项 + - region + - serviceName + - functionName + properties: + region: + title: 地域 + type: string + default: cn-hangzhou + description: 创建应用所在的地区 + enum: + - cn-beijing + - cn-hangzhou + - cn-shanghai + - cn-qingdao + - cn-zhangjiakou + - cn-huhehaote + - cn-shenzhen + - cn-chengdu + - cn-hongkong + - ap-southeast-1 + - ap-southeast-2 + - ap-southeast-3 + - ap-southeast-5 + - ap-northeast-1 + - eu-central-1 + - eu-west-1 + - us-west-1 + - us-east-1 + - ap-south-1 + serviceName: + title: 服务名 + type: string + default: web-framework + description: 服务名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-128 之间 + functionName: + title: 函数名 + type: string + default: start-nest + description: 函数名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-64 之间 diff --git a/web-framework/nodejs/custom-runtime/nest/readme.md b/web-framework/nodejs/custom-runtime/nest/readme.md new file mode 100644 index 000000000..5a9e68bd2 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/readme.md @@ -0,0 +1,82 @@ +# nest-app 帮助文档 + +

+ + + + + + + + + +

+ + + +Nest (NestJS) 是一个用于构建高效、可扩展的 Node.js 服务器端应用程序的开发框架。 + + + + + +## 前期准备 +使用该项目,推荐您拥有以下的产品权限 / 策略: + +| 服务/业务 | 函数计算 | +| --- | --- | +| 权限/策略 | AliyunFCFullAccess | + +
+ + + +# 代码 & 预览 + +- [ :smiley_cat: 源代码](https://github.com/devsapp/start-web-framework/blob/master/web-framework/nodejs/nodejs-runtime/nest) + + + + + +## 部署 & 体验 + + + +- :fire: 通过 [Serverless 应用中心](https://fcnext.console.aliyun.com/applications/create?template=nest-app) , +[![Deploy with Severless Devs](https://img.alicdn.com/imgextra/i1/O1CN01w5RFbX1v45s8TIXPz_!!6000000006118-55-tps-95-28.svg)](https://fcnext.console.aliyun.com/applications/create?template=nest-app) 该应用。 + + + +- 通过 [Serverless Devs Cli](https://www.serverless-devs.com/serverless-devs/install) 进行部署: + - [安装 Serverless Devs Cli 开发者工具](https://www.serverless-devs.com/serverless-devs/install) ,并进行[授权信息配置](https://www.serverless-devs.com/fc/config) ; + - 初始化项目:`s init nest-app -d nest-app` + - 进入项目,并进行项目部署:`cd nest-app && s deploy -y` + + + + + +# 应用详情 + + +本应用仅作为学习和参考使用,您可以基于本项目进行二次开发和完善,实现自己的业务逻辑 + + + + + + +## 开发者社区 + +您如果有关于错误的反馈或者未来的期待,您可以在 [Serverless Devs repo Issues](https://github.com/serverless-devs/serverless-devs/issues) 中进行反馈和交流。如果您想要加入我们的讨论组或者了解 FC 组件的最新动态,您可以通过以下渠道进行: + +

+ +| | | | +|--- | --- | --- | +|

微信公众号:`serverless`
|
微信小助手:`xiaojiangwh`
|
钉钉交流群:`33947367`
| + +

+ +
\ No newline at end of file diff --git a/web-framework/nodejs/custom-runtime/nest/src/.gitignore b/web-framework/nodejs/custom-runtime/nest/src/.gitignore new file mode 100644 index 000000000..87b889ece --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/.gitignore @@ -0,0 +1,35 @@ +# compiled output +code/dist +node_modules + +# Logs +logs +*.log +npm-debug.log* +pnpm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# OS +.DS_Store + +# Tests +code/coverage +code/.nyc_output + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json \ No newline at end of file diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/.eslintrc.js b/web-framework/nodejs/custom-runtime/nest/src/code/.eslintrc.js new file mode 100644 index 000000000..8f5aedb71 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/.eslintrc.js @@ -0,0 +1,25 @@ +module.exports = { + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir : __dirname, + sourceType: 'module', + }, + plugins: ['@typescript-eslint/eslint-plugin'], + extends: [ + 'plugin:@typescript-eslint/recommended', + 'plugin:prettier/recommended', + ], + root: true, + env: { + node: true, + jest: true, + }, + ignorePatterns: ['.eslintrc.js'], + rules: { + '@typescript-eslint/interface-name-prefix': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-explicit-any': 'off', + }, +}; diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/.fcignore b/web-framework/nodejs/custom-runtime/nest/src/code/.fcignore new file mode 100644 index 000000000..d6502634a --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/.fcignore @@ -0,0 +1,3 @@ +./test +./src +./.s \ No newline at end of file diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/.gitignore b/web-framework/nodejs/custom-runtime/nest/src/code/.gitignore new file mode 100644 index 000000000..22f55adc5 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/.gitignore @@ -0,0 +1,35 @@ +# compiled output +/dist +/node_modules + +# Logs +logs +*.log +npm-debug.log* +pnpm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# OS +.DS_Store + +# Tests +/coverage +/.nyc_output + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json \ No newline at end of file diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/.prettierrc b/web-framework/nodejs/custom-runtime/nest/src/code/.prettierrc new file mode 100644 index 000000000..dcb72794f --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "trailingComma": "all" +} \ No newline at end of file diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/README.md b/web-framework/nodejs/custom-runtime/nest/src/code/README.md new file mode 100644 index 000000000..00a13b112 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/README.md @@ -0,0 +1,73 @@ +

+ Nest Logo +

+ +[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 +[circleci-url]: https://circleci.com/gh/nestjs/nest + +

A progressive Node.js framework for building efficient and scalable server-side applications.

+

+NPM Version +Package License +NPM Downloads +CircleCI +Coverage +Discord +Backers on Open Collective +Sponsors on Open Collective + + Support us + +

+ + +## Description + +[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. + +## Installation + +```bash +$ npm install +``` + +## Running the app + +```bash +# development +$ npm run start + +# watch mode +$ npm run start:dev + +# production mode +$ npm run start:prod +``` + +## Test + +```bash +# unit tests +$ npm run test + +# e2e tests +$ npm run test:e2e + +# test coverage +$ npm run test:cov +``` + +## Support + +Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). + +## Stay in touch + +- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) +- Website - [https://nestjs.com](https://nestjs.com/) +- Twitter - [@nestframework](https://twitter.com/nestframework) + +## License + +Nest is [MIT licensed](LICENSE). diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/bootstrap b/web-framework/nodejs/custom-runtime/nest/src/code/bootstrap new file mode 100755 index 000000000..7f37cb7f7 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/bootstrap @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +node dist/main \ No newline at end of file diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/nest-cli.json b/web-framework/nodejs/custom-runtime/nest/src/code/nest-cli.json new file mode 100644 index 000000000..256648114 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/nest-cli.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://json.schemastore.org/nest-cli", + "collection": "@nestjs/schematics", + "sourceRoot": "src" +} diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/package.json b/web-framework/nodejs/custom-runtime/nest/src/code/package.json new file mode 100644 index 000000000..67f561c5b --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/package.json @@ -0,0 +1,71 @@ +{ + "name": "nest-demo", + "version": "0.0.1", + "description": "", + "author": "", + "private": true, + "license": "UNLICENSED", + "scripts": { + "prebuild": "rimraf dist", + "build": "nest build", + "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "start": "nest start", + "start:dev": "nest start --watch", + "start:debug": "nest start --debug --watch", + "start:prod": "node dist/main", + "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", + "test": "jest", + "test:watch": "jest --watch", + "test:cov": "jest --coverage", + "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", + "test:e2e": "jest --config ./test/jest-e2e.json" + }, + "dependencies": { + "@nestjs/common": "^8.0.0", + "@nestjs/core": "^8.0.0", + "@nestjs/platform-express": "^8.0.0", + "reflect-metadata": "^0.1.13", + "rimraf": "^3.0.2", + "rxjs": "^7.2.0" + }, + "devDependencies": { + "@nestjs/cli": "^8.0.0", + "@nestjs/schematics": "^8.0.0", + "@nestjs/testing": "^8.0.0", + "@types/express": "^4.17.13", + "@types/jest": "27.5.0", + "@types/node": "^16.0.0", + "@types/supertest": "^2.0.11", + "@typescript-eslint/eslint-plugin": "^5.0.0", + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^8.0.1", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-prettier": "^4.0.0", + "jest": "28.0.3", + "prettier": "^2.3.2", + "source-map-support": "^0.5.20", + "supertest": "^6.1.3", + "ts-jest": "28.0.1", + "ts-loader": "^9.2.3", + "ts-node": "^10.0.0", + "tsconfig-paths": "4.0.0", + "typescript": "^4.3.5" + }, + "jest": { + "moduleFileExtensions": [ + "js", + "json", + "ts" + ], + "rootDir": "src", + "testRegex": ".*\\.spec\\.ts$", + "transform": { + "^.+\\.(t|j)s$": "ts-jest" + }, + "collectCoverageFrom": [ + "**/*.(t|j)s" + ], + "coverageDirectory": "../coverage", + "testEnvironment": "node" + } +} diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/src/app.controller.spec.ts b/web-framework/nodejs/custom-runtime/nest/src/code/src/app.controller.spec.ts new file mode 100644 index 000000000..d22f3890a --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/src/app.controller.spec.ts @@ -0,0 +1,22 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { AppController } from './app.controller'; +import { AppService } from './app.service'; + +describe('AppController', () => { + let appController: AppController; + + beforeEach(async () => { + const app: TestingModule = await Test.createTestingModule({ + controllers: [AppController], + providers: [AppService], + }).compile(); + + appController = app.get(AppController); + }); + + describe('root', () => { + it('should return "Hello World!"', () => { + expect(appController.getHello()).toBe('Hello World!'); + }); + }); +}); diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/src/app.controller.ts b/web-framework/nodejs/custom-runtime/nest/src/code/src/app.controller.ts new file mode 100644 index 000000000..cce879ee6 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/src/app.controller.ts @@ -0,0 +1,12 @@ +import { Controller, Get } from '@nestjs/common'; +import { AppService } from './app.service'; + +@Controller() +export class AppController { + constructor(private readonly appService: AppService) {} + + @Get() + getHello(): string { + return this.appService.getHello(); + } +} diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/src/app.module.ts b/web-framework/nodejs/custom-runtime/nest/src/code/src/app.module.ts new file mode 100644 index 000000000..86628031c --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/src/app.module.ts @@ -0,0 +1,10 @@ +import { Module } from '@nestjs/common'; +import { AppController } from './app.controller'; +import { AppService } from './app.service'; + +@Module({ + imports: [], + controllers: [AppController], + providers: [AppService], +}) +export class AppModule {} diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/src/app.service.ts b/web-framework/nodejs/custom-runtime/nest/src/code/src/app.service.ts new file mode 100644 index 000000000..4942ef471 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/src/app.service.ts @@ -0,0 +1,93 @@ +import { Injectable } from '@nestjs/common'; + +@Injectable() +export class AppService { + getHello(): string { + return ` + + + + + 快速部署一个 Nest 应用 + + + + +
+
+ +
+ + +

Github

+
+
+
+
+

快速部署一个 Nest 应用

+
+
+

Serverless Devs 是一个开源开放的 Serverless 开发者平台,致力于为开发者提供强大的工具链体系。通过该平台,开发者可以一键体验多云 Serverless 产品,极速部署 Serverless 项目。

+ Serverless Devs +
+
+
+
+
+
1
+

介绍

+

这是一个 Nest 应用示例,可以通过 Serverless Devs 工具将项目一键部署到云开发环境

+
+
+
2
+

文档

+

NestJS 官方在线文档,参见 https://nestjs.com/.

+
+
+
3
+

快速部署一个 Nest 应用

+
+
+

步骤一. 准备工作

+

具体步骤请参照 Serverless Cli 安装

+

步骤二. 初始化应用示例

+
s init start-nest
+

步骤三. 一键部署

+

进入到项目目录,在命令行执行

+
s deploy
+

帮助文档

+ +
+
+
+
4
+

Github

+

您对此应用有任何问题或者建议,欢迎给我们 提issue

+
+
+ + +`; + } +} diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/src/main.ts b/web-framework/nodejs/custom-runtime/nest/src/code/src/main.ts new file mode 100644 index 000000000..13cad38cf --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/src/main.ts @@ -0,0 +1,8 @@ +import { NestFactory } from '@nestjs/core'; +import { AppModule } from './app.module'; + +async function bootstrap() { + const app = await NestFactory.create(AppModule); + await app.listen(3000); +} +bootstrap(); diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/test/app.e2e-spec.ts b/web-framework/nodejs/custom-runtime/nest/src/code/test/app.e2e-spec.ts new file mode 100644 index 000000000..50cda6233 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/test/app.e2e-spec.ts @@ -0,0 +1,24 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { INestApplication } from '@nestjs/common'; +import * as request from 'supertest'; +import { AppModule } from './../src/app.module'; + +describe('AppController (e2e)', () => { + let app: INestApplication; + + beforeEach(async () => { + const moduleFixture: TestingModule = await Test.createTestingModule({ + imports: [AppModule], + }).compile(); + + app = moduleFixture.createNestApplication(); + await app.init(); + }); + + it('/ (GET)', () => { + return request(app.getHttpServer()) + .get('/') + .expect(200) + .expect('Hello World!'); + }); +}); diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/test/jest-e2e.json b/web-framework/nodejs/custom-runtime/nest/src/code/test/jest-e2e.json new file mode 100644 index 000000000..e9d912f3e --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/test/jest-e2e.json @@ -0,0 +1,9 @@ +{ + "moduleFileExtensions": ["js", "json", "ts"], + "rootDir": ".", + "testEnvironment": "node", + "testRegex": ".e2e-spec.ts$", + "transform": { + "^.+\\.(t|j)s$": "ts-jest" + } +} diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/tsconfig.build.json b/web-framework/nodejs/custom-runtime/nest/src/code/tsconfig.build.json new file mode 100644 index 000000000..64f86c6bd --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] +} diff --git a/web-framework/nodejs/custom-runtime/nest/src/code/tsconfig.json b/web-framework/nodejs/custom-runtime/nest/src/code/tsconfig.json new file mode 100644 index 000000000..adb614cab --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/code/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, + "target": "es2017", + "sourceMap": true, + "outDir": "./dist", + "baseUrl": "./", + "incremental": true, + "skipLibCheck": true, + "strictNullChecks": false, + "noImplicitAny": false, + "strictBindCallApply": false, + "forceConsistentCasingInFileNames": false, + "noFallthroughCasesInSwitch": false + } +} diff --git a/web-framework/nodejs/custom-runtime/nest/src/readme.md b/web-framework/nodejs/custom-runtime/nest/src/readme.md new file mode 100644 index 000000000..5a9e68bd2 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/readme.md @@ -0,0 +1,82 @@ +# nest-app 帮助文档 + +

+ + + + + + + + + +

+ + + +Nest (NestJS) 是一个用于构建高效、可扩展的 Node.js 服务器端应用程序的开发框架。 + + + + + +## 前期准备 +使用该项目,推荐您拥有以下的产品权限 / 策略: + +| 服务/业务 | 函数计算 | +| --- | --- | +| 权限/策略 | AliyunFCFullAccess | + +
+ + + +# 代码 & 预览 + +- [ :smiley_cat: 源代码](https://github.com/devsapp/start-web-framework/blob/master/web-framework/nodejs/nodejs-runtime/nest) + + + + + +## 部署 & 体验 + + + +- :fire: 通过 [Serverless 应用中心](https://fcnext.console.aliyun.com/applications/create?template=nest-app) , +[![Deploy with Severless Devs](https://img.alicdn.com/imgextra/i1/O1CN01w5RFbX1v45s8TIXPz_!!6000000006118-55-tps-95-28.svg)](https://fcnext.console.aliyun.com/applications/create?template=nest-app) 该应用。 + + + +- 通过 [Serverless Devs Cli](https://www.serverless-devs.com/serverless-devs/install) 进行部署: + - [安装 Serverless Devs Cli 开发者工具](https://www.serverless-devs.com/serverless-devs/install) ,并进行[授权信息配置](https://www.serverless-devs.com/fc/config) ; + - 初始化项目:`s init nest-app -d nest-app` + - 进入项目,并进行项目部署:`cd nest-app && s deploy -y` + + + + + +# 应用详情 + + +本应用仅作为学习和参考使用,您可以基于本项目进行二次开发和完善,实现自己的业务逻辑 + + + + + + +## 开发者社区 + +您如果有关于错误的反馈或者未来的期待,您可以在 [Serverless Devs repo Issues](https://github.com/serverless-devs/serverless-devs/issues) 中进行反馈和交流。如果您想要加入我们的讨论组或者了解 FC 组件的最新动态,您可以通过以下渠道进行: + +

+ +| | | | +|--- | --- | --- | +|

微信公众号:`serverless`
|
微信小助手:`xiaojiangwh`
|
钉钉交流群:`33947367`
| + +

+ +
\ No newline at end of file diff --git a/web-framework/nodejs/custom-runtime/nest/src/s.yaml b/web-framework/nodejs/custom-runtime/nest/src/s.yaml new file mode 100644 index 000000000..9aae36e4f --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/s.yaml @@ -0,0 +1,85 @@ +# ------------------------------------ +# If you need English case, you can refer to [s_en.yaml] file +# ------------------------------------ +# 欢迎您使用阿里云函数计算 FC 组件进行项目开发 +# 组件仓库地址:https://github.com/devsapp/fc +# 组件帮助文档:https://www.serverless-devs.com/fc/readme +# Yaml参考文档:https://www.serverless-devs.com/fc/yaml/readme +# 关于: +# - Serverless Devs和FC组件的关系、如何声明/部署多个函数、超过50M的代码包如何部署 +# - 关于.fcignore使用方法、工具中.s目录是做什么、函数进行build操作之后如何处理build的产物 +# 等问题,可以参考文档:https://www.serverless-devs.com/fc/tips +# 关于如何做CICD等问题,可以参考:https://www.serverless-devs.com/serverless-devs/cicd +# 关于如何进行环境划分等问题,可以参考:https://www.serverless-devs.com/serverless-devs/extend +# 更多函数计算案例,可参考:https://github.com/devsapp/awesome/ +# 有问题快来钉钉群问一下吧:33947367 +# ------------------------------------ +edition: 1.0.0 +name: web-framework-app +# access 是当前应用所需要的密钥信息配置: +# 密钥配置可以参考:https://www.serverless-devs.com/serverless-devs/command/config +# 密钥使用顺序可以参考:https://www.serverless-devs.com/serverless-devs/tool#密钥使用顺序与规范 +access: "{{ access }}" + +vars: # 全局变量 + region: "{{ region }}" + service: + name: "{{ serviceName }}" + description: 'Serverless Devs Web Framework Service' + +services: + framework: # 业务名称/模块名称 + # 如果只想针对 framework 下面的业务进行相关操作,可以在命令行中加上 framework,例如: + # 只对framework进行构建:s framework build + # 如果不带有 framework ,而是直接执行 s build,工具则会对当前Yaml下,所有和 framework 平级的业务模块(如有其他平级的模块,例如下面注释的next-function),按照一定顺序进行 build 操作 + component: fc # 组件名称,Serverless Devs 工具本身类似于一种游戏机,不具备具体的业务能力,组件类似于游戏卡,用户通过向游戏机中插入不同的游戏卡实现不同的功能,即通过使用不同的组件实现不同的具体业务能力 + actions: # 自定义执行逻辑,关于actions 的使用,可以参考:https://www.serverless-devs.com/serverless-devs/yaml#行为描述 + pre-deploy: # 在deploy之前运行 + - run: npm install --production # 要执行的系统命令,类似于一种钩子的形式 + path: ./code # 执行系统命令/钩子的路径 + - run: npm run build + path: ./code + # - component: fc build --use-docker # 要运行的组件,格式为【component: 组件名 命令 参数】(可以通过s cli registry search --type Component 获取组件列表) +# - plugin: myplugin # 与运行的插件 (可以通过s cli registry search --type Plugin 获取组件列表) +# args: # 插件的参数信息 +# testKey: testValue +# post-deploy: # 在deploy之后运行 +# - component: fc versions publish # 要运行的命令行 + props: # 组件的属性值 + region: ${vars.region} # 关于变量的使用方法,可以参考:https://www.serverless-devs.com/serverless-devs/yaml#变量赋值 + service: ${vars.service} + function: + name: "{{ functionName }}" + description: 'Serverless Devs Web Framework Function' + codeUri: ./code + runtime: custom + memorySize: 512 + timeout: 6 + caPort: 3000 + triggers: + - name: http-trigger + type: http + config: + authType: anonymous + methods: + - GET + - POST + customDomains: + - domainName: auto + protocol: HTTP + routeConfigs: + - path: /* +# next-function: # 第二个函数的案例,仅供参考 +# # 如果在当前项目下执行 s deploy,会同时部署模块: +# # helloworld:服务hello-world-service,函数cpp-event-function +# # next-function:服务hello-world-service,函数next-function-example +# # 如果想单独部署当前服务与函数,可以执行 s + 模块名/业务名 + deploy,例如:s next-function deploy +# # 如果想单独部署当前函数,可以执行 s + 模块名/业务名 + deploy function,例如:s next-function deploy function +# # 更多命令可参考:https://www.serverless-devs.com/fc/readme#文档相关 +# component: fc +# props: +# region: ${vars.region} +# service: ${vars.service} # 应用整体的服务配置 +# function: # 定义一个新的函数 +# name: next-function-example +# description: 'hello world by serverless devs' \ No newline at end of file diff --git a/web-framework/nodejs/custom-runtime/nest/src/s_en.yaml b/web-framework/nodejs/custom-runtime/nest/src/s_en.yaml new file mode 100644 index 000000000..fa3bf7f18 --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/src/s_en.yaml @@ -0,0 +1,87 @@ +# ------------------------------------ +# If you want to use this file directly, please add [-t/--template] parameter, for example [s deploy -t s_en.yaml] +# ------------------------------------ +# Welcome to use Alibaba Cloud Function Compute FC components for project development +# Component warehouse address: https://github.com/devsapp/fc +# Component help documentation: https://www.serverless-devs.com/fc/readme +# Yaml reference documentation: https://www.serverless-devs.com/fc/yaml/readme +# About: +# - The relationship between Serverless Devs and FC components, how to declare/deploy multiple functions, how to deploy code packages over 50M +# - About the usage of .fcignore, what the .s directory in the tool does, and how to process the build product after the function performs the build operation +# and other issues, you can refer to the documentation: https://www.serverless-devs.com/fc/tips +# For questions about how to do CICD, please refer to: https://www.serverless-devs.com/serverless-devs/cicd +# For issues such as how to divide the environment, please refer to: https://www.serverless-devs.com/serverless-devs/extend +# For more function calculation cases, please refer to: https://github.com/devsapp/awesome/blob/main/README_en.md +# If you have any questions, please come to the DingTalk group and ask: 33947367 +# ------------------------------------ +edition: 1.0.0 +name: web-framework-app +# access is the key information configuration required by the current application: +# Key configuration can refer to: https://www.serverless-devs.com/serverless-devs/command/config +# For the order of key usage, please refer to: https://www.serverless-devs.com/serverless-devs/tool#Key usage order and specification +# access: default + +vars: # global variables + region: cn-hangzhou + service: + name: hello-world-service + description: 'Serverless Devs Web Framework Service' + +services: + framework: # business name/module name + # If you only want to perform related operations on the business below framework, you can add framework to the command line, for example: + # Build only framework: s framework build + # If s build is directly executed without framework, the tool will perform the same operation on all business modules at the same level as framework under the current Yaml (if there are other level modules, such as the next-function commented below), according to certain Sequential build operations + component: fc # The name of the component. The Serverless Devs tool itself is similar to a game console and does not have specific business capabilities. The component is similar to a game card. Users can achieve different functions by inserting different game cards into the game console, that is, by using Different components implement different specific business capabilities + actions: # Customize execution logic. For the use of actions, please refer to: https://www.serverless-devs.com/serverless-devs/yaml#Behavior description + pre-deploy: # run before deploy + - run: npm install --production + path: ./code + - run: npm run build + path: ./code +# - component: fc build --use-docker # The component to run, the format is [component: component name command parameter] (you can get the component list through s cli registry search --type Component) +# - run: docker build xxx # System command to execute, similar to a hook +# path: ./src # The path to execute system commands/hooks +# - plugin: myplugin # and running plugins (you can get a list of components via s cli registry search --type Plugin) +# args: # parameter information of the plugin +# testKey: testValue +# post-deploy: # run after deploy +# - component: fc versions publish # command line to run + props: + region: ${vars.region} # For the usage of variables, please refer to: https://www.serverless-devs.com/serverless-devs/yaml#Variable assignment + service: ${vars.service} + function: + name: nest + description: 'Serverless Devs Web Framework Function' + codeUri: ./code + runtime: custom + memorySize: 512 + timeout: 6 + caPort: 3000 + triggers: + - name: http-trigger + type: http + config: + authType: anonymous + methods: + - GET + - POST + customDomains: + - domainName: auto + protocol: HTTP + routeConfigs: + - path: /* +# next-function: # The case of the second function, just for reference +# # If you execute s deploy under the current project, the modules will be deployed at the same time: +# # helloworld: service hello-world-service, function cpp-event-function +# # next-function: service hello-world-service, function next-function-example +# # If you want to deploy the current service and function separately, you can execute s + module name/business name + deploy, for example: s next-function deploy +# # If you want to deploy the current function separately, you can execute s + module name/business name + deploy function, for example: s next-function deploy function +# # For more commands, please refer to: https://www.serverless-devs.com/fc/readme#Document related +# component: fc +# props: +# region: ${vars.region} +# service: ${vars.service} # The overall service configuration of the application +# function: # define a new function +# name: next-function-example +# description: 'hello world by serverless devs' \ No newline at end of file diff --git a/web-framework/nodejs/custom-runtime/nest/version.md b/web-framework/nodejs/custom-runtime/nest/version.md new file mode 100644 index 000000000..b51e0aaac --- /dev/null +++ b/web-framework/nodejs/custom-runtime/nest/version.md @@ -0,0 +1 @@ +- 新版本支持 \ No newline at end of file