Skip to content

Commit

Permalink
add start nest demo
Browse files Browse the repository at this point in the history
  • Loading branch information
heimanba committed Jul 4, 2022
1 parent 347a071 commit cca65dd
Show file tree
Hide file tree
Showing 27 changed files with 878 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
.s
node_modules
package-lock.json
./index.py
./index.py
.vscode
2 changes: 1 addition & 1 deletion update.list
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web-framework/python/webpy
web-framework/nodejs/custom-runtime/nest
24 changes: 24 additions & 0 deletions web-framework/nodejs/custom-runtime/nest/hook/index.js
Original file line number Diff line number Diff line change
@@ -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
}
58 changes: 58 additions & 0 deletions web-framework/nodejs/custom-runtime/nest/publish.yaml
Original file line number Diff line number Diff line change
@@ -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 之间
82 changes: 82 additions & 0 deletions web-framework/nodejs/custom-runtime/nest/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# nest-app 帮助文档

<p align="center" class="flex justify-center">
<a href="https://www.serverless-devs.com" class="ml-1">
<img src="http://editor.devsapp.cn/icon?package=nest-app&type=packageType">
</a>
<a href="http://www.devsapp.cn/details.html?name=nest-app" class="ml-1">
<img src="http://editor.devsapp.cn/icon?package=nest-app&type=packageVersion">
</a>
<a href="http://www.devsapp.cn/details.html?name=nest-app" class="ml-1">
<img src="http://editor.devsapp.cn/icon?package=nest-app&type=packageDownload">
</a>
</p>

<description>

Nest (NestJS) 是一个用于构建高效、可扩展的 Node.js 服务器端应用程序的开发框架。

</description>

<table>

## 前期准备
使用该项目,推荐您拥有以下的产品权限 / 策略:

| 服务/业务 | 函数计算 |
| --- | --- |
| 权限/策略 | AliyunFCFullAccess |

</table>

<codepre id="codepre">

# 代码 & 预览

- [ :smiley_cat: 源代码](https://github.com/devsapp/start-web-framework/blob/master/web-framework/nodejs/nodejs-runtime/nest)

</codepre>

<deploy>

## 部署 & 体验

<appcenter>

- :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) 该应用。

</appcenter>

- 通过 [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`

</deploy>

<appdetail id="flushContent">

# 应用详情


本应用仅作为学习和参考使用,您可以基于本项目进行二次开发和完善,实现自己的业务逻辑


</appdetail>

<devgroup>

## 开发者社区

您如果有关于错误的反馈或者未来的期待,您可以在 [Serverless Devs repo Issues](https://github.com/serverless-devs/serverless-devs/issues) 中进行反馈和交流。如果您想要加入我们的讨论组或者了解 FC 组件的最新动态,您可以通过以下渠道进行:

<p align="center">

| <img src="https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1635407298906_20211028074819117230.png" width="130px" > | <img src="https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1635407044136_20211028074404326599.png" width="130px" > | <img src="https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1635407252200_20211028074732517533.png" width="130px" > |
|--- | --- | --- |
| <center>微信公众号:`serverless`</center> | <center>微信小助手:`xiaojiangwh`</center> | <center>钉钉交流群:`33947367`</center> |

</p>

</devgroup>
35 changes: 35 additions & 0 deletions web-framework/nodejs/custom-runtime/nest/src/.gitignore
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions web-framework/nodejs/custom-runtime/nest/src/code/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -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',
},
};
3 changes: 3 additions & 0 deletions web-framework/nodejs/custom-runtime/nest/src/code/.fcignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
./test
./src
./.s
35 changes: 35 additions & 0 deletions web-framework/nodejs/custom-runtime/nest/src/code/.gitignore
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions web-framework/nodejs/custom-runtime/nest/src/code/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
73 changes: 73 additions & 0 deletions web-framework/nodejs/custom-runtime/nest/src/code/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
</p>

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

<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->

## 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).
2 changes: 2 additions & 0 deletions web-framework/nodejs/custom-runtime/nest/src/code/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
node dist/main
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src"
}
Loading

0 comments on commit cca65dd

Please sign in to comment.