├── .gitignore
├── .prettierrc.js
├── LICENSE
├── README.md
├── aliyun
├── demo-aggregation
│ ├── .gitignore
│ ├── README.md
│ ├── f.yml
│ ├── package.json
│ ├── src
│ │ ├── hello.ts
│ │ └── index.ts
│ ├── test
│ │ └── index.test.ts
│ └── tsconfig.json
├── demo-egg-layer
│ ├── .gitignore
│ ├── app
│ │ ├── controller
│ │ │ └── home.js
│ │ └── router.js
│ ├── config
│ │ ├── config.default.js
│ │ └── plugin.js
│ ├── f.yml
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── index.test.ts
├── demo-faas-apigw
│ ├── README.md
│ ├── f.yml
│ ├── package.json
│ ├── src
│ │ └── index.ts
│ ├── test
│ │ └── index.test.ts
│ └── tsconfig.json
├── demo-faas-http
│ ├── README.md
│ ├── f.yml
│ ├── package.json
│ ├── src
│ │ └── index.ts
│ ├── test
│ │ └── index.test.ts
│ └── tsconfig.json
├── demo-faas-log
│ ├── README.md
│ ├── f.yml
│ ├── package.json
│ ├── src
│ │ └── index.ts
│ ├── test
│ │ └── index.test.ts
│ └── tsconfig.json
├── demo-faas-mq
│ ├── README.md
│ ├── f.yml
│ ├── package.json
│ ├── src
│ │ └── index.ts
│ ├── test
│ │ └── index.test.ts
│ └── tsconfig.json
├── demo-faas-no-event
│ ├── README.md
│ ├── f.yml
│ ├── package.json
│ ├── src
│ │ └── index.ts
│ ├── test
│ │ └── index.test.ts
│ └── tsconfig.json
├── demo-faas-os
│ ├── README.md
│ ├── f.yml
│ ├── package.json
│ ├── src
│ │ └── index.ts
│ ├── test
│ │ └── index.test.ts
│ └── tsconfig.json
├── demo-faas-timer
│ ├── README.md
│ ├── f.yml
│ ├── package.json
│ ├── src
│ │ └── index.ts
│ ├── test
│ │ └── index.test.ts
│ └── tsconfig.json
└── demo-image
│ ├── .gitignore
│ ├── README.md
│ ├── f.yml
│ ├── package.json
│ ├── public
│ └── midway.png
│ ├── src
│ └── index.ts
│ ├── test
│ └── index.test.ts
│ └── tsconfig.json
├── framework
└── egg-mysql
│ ├── boilerplate
│ ├── README.md
│ ├── f.yml
│ ├── package.json
│ ├── src
│ │ ├── config
│ │ │ ├── config.default.ts
│ │ │ └── plugin.ts
│ │ ├── configuration.ts
│ │ └── index.ts
│ └── tsconfig.json
│ ├── package.json
│ ├── test
│ └── index.test.js
│ └── tsconfig.json
├── integration
├── antd
│ ├── README.md
│ ├── boilerplate
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ ├── index.html
│ │ │ ├── logo192.png
│ │ │ ├── logo512.png
│ │ │ ├── manifest.json
│ │ │ └── robots.txt
│ │ ├── src
│ │ │ ├── App.css
│ │ │ ├── App.test.tsx
│ │ │ ├── App.tsx
│ │ │ ├── apis
│ │ │ │ ├── config
│ │ │ │ │ └── config.default.ts
│ │ │ │ ├── configuration.ts
│ │ │ │ └── index.ts
│ │ │ ├── index.css
│ │ │ ├── index.tsx
│ │ │ ├── react-app-env.d.ts
│ │ │ ├── serviceWorker.ts
│ │ │ ├── setupProxy.js
│ │ │ ├── setupTests.ts
│ │ │ └── table.tsx
│ │ └── tsconfig.json
│ └── package.json
├── comment
│ └── boilerplate
│ │ ├── README.md
│ │ ├── _.gitignore
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── src
│ │ ├── config
│ │ │ └── config.default.ts
│ │ ├── configuration.ts
│ │ └── index.ts
│ │ ├── static
│ │ ├── index.html
│ │ ├── pcommit.js
│ │ └── robots.txt
│ │ └── tsconfig.json
├── ding-robot
│ ├── README.md
│ ├── boilerplate
│ │ ├── README.md
│ │ ├── _.gitignore
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ ├── index.html
│ │ │ ├── manifest.json
│ │ │ └── robots.txt
│ │ ├── src
│ │ │ ├── App.tsx
│ │ │ ├── apis
│ │ │ │ ├── config
│ │ │ │ │ └── config.default.ts
│ │ │ │ ├── configuration.ts
│ │ │ │ └── index.ts
│ │ │ ├── app.css
│ │ │ ├── index.tsx
│ │ │ ├── react-app-env.d.ts
│ │ │ ├── setupProxy.js
│ │ │ └── utils.ts
│ │ └── tsconfig.json
│ └── package.json
├── email
│ └── boilerplate
│ │ ├── README.md
│ │ ├── _.gitignore
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── src
│ │ ├── config
│ │ │ └── config.default.ts
│ │ ├── configuration.ts
│ │ └── index.ts
│ │ ├── static
│ │ ├── index.html
│ │ └── robots.txt
│ │ └── tsconfig.json
├── github-contributors
│ ├── README.md
│ └── boilerplate
│ │ ├── README.md
│ │ ├── _.gitignore
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ │ ├── src
│ │ ├── App.test.tsx
│ │ ├── App.tsx
│ │ ├── Detail.tsx
│ │ ├── Home.tsx
│ │ ├── Layout.tsx
│ │ ├── List.tsx
│ │ ├── apis
│ │ │ ├── config
│ │ │ │ └── config.default.ts
│ │ │ ├── configuration.ts
│ │ │ └── index.ts
│ │ ├── common.css
│ │ ├── home.css
│ │ ├── index.css
│ │ ├── index.tsx
│ │ ├── layout.css
│ │ ├── logo.svg
│ │ ├── react-app-env.d.ts
│ │ ├── serviceWorker.ts
│ │ ├── setupProxy.js
│ │ └── setupTests.ts
│ │ └── tsconfig.json
├── hexo
│ ├── README.md
│ ├── boilerplate
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── _config.yml
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── scaffolds
│ │ │ ├── draft.md
│ │ │ ├── page.md
│ │ │ └── post.md
│ │ ├── source
│ │ │ └── _posts
│ │ │ │ └── hello-world.md
│ │ ├── src
│ │ │ ├── config
│ │ │ │ └── config.default.ts
│ │ │ ├── configuration.ts
│ │ │ ├── mw
│ │ │ │ └── rewrite.ts
│ │ │ └── render.ts
│ │ ├── themes
│ │ │ └── landscape
│ │ │ │ ├── .gitignore
│ │ │ │ ├── Gruntfile.js
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── _config.yml
│ │ │ │ ├── languages
│ │ │ │ ├── de.yml
│ │ │ │ ├── default.yml
│ │ │ │ ├── es.yml
│ │ │ │ ├── fr.yml
│ │ │ │ ├── ja.yml
│ │ │ │ ├── ko.yml
│ │ │ │ ├── nl.yml
│ │ │ │ ├── no.yml
│ │ │ │ ├── pt.yml
│ │ │ │ ├── ru.yml
│ │ │ │ ├── zh-CN.yml
│ │ │ │ └── zh-TW.yml
│ │ │ │ ├── layout
│ │ │ │ ├── _partial
│ │ │ │ │ ├── after-footer.ejs
│ │ │ │ │ ├── archive-post.ejs
│ │ │ │ │ ├── archive.ejs
│ │ │ │ │ ├── article.ejs
│ │ │ │ │ ├── footer.ejs
│ │ │ │ │ ├── gauges-analytics.ejs
│ │ │ │ │ ├── google-analytics.ejs
│ │ │ │ │ ├── head.ejs
│ │ │ │ │ ├── header.ejs
│ │ │ │ │ ├── mobile-nav.ejs
│ │ │ │ │ ├── post
│ │ │ │ │ │ ├── category.ejs
│ │ │ │ │ │ ├── date.ejs
│ │ │ │ │ │ ├── gallery.ejs
│ │ │ │ │ │ ├── nav.ejs
│ │ │ │ │ │ ├── tag.ejs
│ │ │ │ │ │ └── title.ejs
│ │ │ │ │ └── sidebar.ejs
│ │ │ │ ├── _widget
│ │ │ │ │ ├── archive.ejs
│ │ │ │ │ ├── category.ejs
│ │ │ │ │ ├── recent_posts.ejs
│ │ │ │ │ ├── tag.ejs
│ │ │ │ │ └── tagcloud.ejs
│ │ │ │ ├── archive.ejs
│ │ │ │ ├── category.ejs
│ │ │ │ ├── index.ejs
│ │ │ │ ├── layout.ejs
│ │ │ │ ├── page.ejs
│ │ │ │ ├── post.ejs
│ │ │ │ └── tag.ejs
│ │ │ │ ├── package.json
│ │ │ │ ├── scripts
│ │ │ │ └── fancybox.js
│ │ │ │ └── source
│ │ │ │ ├── css
│ │ │ │ ├── _extend.styl
│ │ │ │ ├── _partial
│ │ │ │ │ ├── archive.styl
│ │ │ │ │ ├── article.styl
│ │ │ │ │ ├── comment.styl
│ │ │ │ │ ├── footer.styl
│ │ │ │ │ ├── header.styl
│ │ │ │ │ ├── highlight.styl
│ │ │ │ │ ├── mobile.styl
│ │ │ │ │ ├── sidebar-aside.styl
│ │ │ │ │ ├── sidebar-bottom.styl
│ │ │ │ │ └── sidebar.styl
│ │ │ │ ├── _util
│ │ │ │ │ ├── grid.styl
│ │ │ │ │ └── mixin.styl
│ │ │ │ ├── _variables.styl
│ │ │ │ ├── fonts
│ │ │ │ │ ├── FontAwesome.otf
│ │ │ │ │ ├── fontawesome-webfont.eot
│ │ │ │ │ ├── fontawesome-webfont.svg
│ │ │ │ │ ├── fontawesome-webfont.ttf
│ │ │ │ │ └── fontawesome-webfont.woff
│ │ │ │ ├── images
│ │ │ │ │ └── banner.jpg
│ │ │ │ └── style.styl
│ │ │ │ ├── fancybox
│ │ │ │ ├── blank.gif
│ │ │ │ ├── fancybox_loading.gif
│ │ │ │ ├── fancybox_loading@2x.gif
│ │ │ │ ├── fancybox_overlay.png
│ │ │ │ ├── fancybox_sprite.png
│ │ │ │ ├── fancybox_sprite@2x.png
│ │ │ │ ├── helpers
│ │ │ │ │ ├── fancybox_buttons.png
│ │ │ │ │ ├── jquery.fancybox-buttons.css
│ │ │ │ │ ├── jquery.fancybox-buttons.js
│ │ │ │ │ ├── jquery.fancybox-media.js
│ │ │ │ │ ├── jquery.fancybox-thumbs.css
│ │ │ │ │ └── jquery.fancybox-thumbs.js
│ │ │ │ ├── jquery.fancybox.css
│ │ │ │ ├── jquery.fancybox.js
│ │ │ │ └── jquery.fancybox.pack.js
│ │ │ │ └── js
│ │ │ │ └── script.js
│ │ └── tsconfig.json
│ ├── package.json
│ └── test
│ │ └── index.test.js
├── hooks-react
│ ├── README.md
│ ├── boilerplate
│ │ ├── .env
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── config-overrides.js
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ ├── index.html
│ │ │ ├── logo192.png
│ │ │ ├── logo512.png
│ │ │ ├── manifest.json
│ │ │ └── robots.txt
│ │ ├── src
│ │ │ ├── App.test.tsx
│ │ │ ├── App.tsx
│ │ │ ├── Home.tsx
│ │ │ ├── List.tsx
│ │ │ ├── apis
│ │ │ │ ├── config
│ │ │ │ │ └── config.default.ts
│ │ │ │ ├── configuration.ts
│ │ │ │ ├── hook
│ │ │ │ │ └── useMethod.ts
│ │ │ │ ├── lambda
│ │ │ │ │ └── index.ts
│ │ │ │ └── render
│ │ │ │ │ └── [...index].ts
│ │ │ ├── index.css
│ │ │ ├── index.tsx
│ │ │ ├── logo.svg
│ │ │ ├── react-app-env.d.ts
│ │ │ ├── serviceWorker.ts
│ │ │ ├── setupProxy.js
│ │ │ └── setupTests.ts
│ │ └── tsconfig.json
│ ├── package.json
│ └── test
│ │ └── index.test.js
├── hooks-vue3
│ ├── README.md
│ ├── boilerplate
│ │ ├── .browserslistrc
│ │ ├── .eslintrc.js
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── babel.config.js
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ └── index.html
│ │ ├── src
│ │ │ ├── App.vue
│ │ │ ├── apis
│ │ │ │ ├── config
│ │ │ │ │ └── config.default.ts
│ │ │ │ ├── configuration.ts
│ │ │ │ ├── hook
│ │ │ │ │ └── useMethod.ts
│ │ │ │ ├── lambda
│ │ │ │ │ └── index.ts
│ │ │ │ └── render
│ │ │ │ │ └── [...index].ts
│ │ │ ├── assets
│ │ │ │ └── logo.png
│ │ │ ├── components
│ │ │ │ └── HelloWorld.vue
│ │ │ ├── main.ts
│ │ │ ├── router
│ │ │ │ └── index.ts
│ │ │ ├── shims-vue.d.ts
│ │ │ └── views
│ │ │ │ ├── About.vue
│ │ │ │ └── Home.vue
│ │ ├── tsconfig.json
│ │ └── vue.config.js
│ ├── package.json
│ └── test
│ │ └── index.test.js
├── navigation
│ └── boilerplate
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ │ ├── src
│ │ ├── apis
│ │ │ ├── config
│ │ │ │ └── config.default.ts
│ │ │ ├── configuration.ts
│ │ │ └── index.ts
│ │ ├── classManager.tsx
│ │ ├── form.css
│ │ ├── index.css
│ │ ├── index.tsx
│ │ ├── itemManager.tsx
│ │ ├── react-app-env.d.ts
│ │ ├── search.css
│ │ ├── search.tsx
│ │ ├── setupProxy.js
│ │ ├── userManager.tsx
│ │ └── utils.ts
│ │ └── tsconfig.json
├── ots
│ ├── README.md
│ ├── boilerplate
│ │ ├── README.md
│ │ ├── _.gitignore
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ ├── index.html
│ │ │ ├── logo192.png
│ │ │ ├── logo512.png
│ │ │ ├── manifest.json
│ │ │ └── robots.txt
│ │ ├── src
│ │ │ ├── apis
│ │ │ │ ├── config
│ │ │ │ │ └── config.default.ts
│ │ │ │ ├── configuration.ts
│ │ │ │ └── index.ts
│ │ │ ├── components
│ │ │ │ ├── entry.tsx
│ │ │ │ ├── footer.tsx
│ │ │ │ └── todos.tsx
│ │ │ ├── index.css
│ │ │ ├── index.tsx
│ │ │ ├── react-app-env.d.ts
│ │ │ └── setupProxy.js
│ │ └── tsconfig.json
│ ├── package.json
│ └── test
│ │ └── index.test.js
├── piano
│ ├── README.md
│ ├── boilerplate
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ ├── index.html
│ │ │ ├── logo192.png
│ │ │ ├── logo512.png
│ │ │ ├── manifest.json
│ │ │ ├── midi
│ │ │ │ ├── 60.wav
│ │ │ │ ├── 61.wav
│ │ │ │ ├── 62.wav
│ │ │ │ ├── 63.wav
│ │ │ │ ├── 64.wav
│ │ │ │ ├── 65.wav
│ │ │ │ ├── 66.wav
│ │ │ │ ├── 67.wav
│ │ │ │ ├── 68.wav
│ │ │ │ ├── 69.wav
│ │ │ │ ├── 70.wav
│ │ │ │ ├── 71.wav
│ │ │ │ ├── 72.wav
│ │ │ │ ├── 73.wav
│ │ │ │ ├── 74.wav
│ │ │ │ ├── 75.wav
│ │ │ │ ├── 76.wav
│ │ │ │ └── 77.wav
│ │ │ ├── mp3
│ │ │ │ ├── 90 BPM 34.mp3
│ │ │ │ └── 90 BPM 44.mp3
│ │ │ └── robots.txt
│ │ ├── src
│ │ │ ├── App.css
│ │ │ ├── App.test.tsx
│ │ │ ├── App.tsx
│ │ │ ├── apis
│ │ │ │ ├── config
│ │ │ │ │ └── config.default.ts
│ │ │ │ ├── configuration.ts
│ │ │ │ ├── getAudio.ts
│ │ │ │ └── render.ts
│ │ │ ├── common.css
│ │ │ ├── index.css
│ │ │ ├── index.tsx
│ │ │ ├── logo.svg
│ │ │ ├── react-app-env.d.ts
│ │ │ ├── serviceWorker.ts
│ │ │ ├── setupProxy.js
│ │ │ └── setupTests.ts
│ │ └── tsconfig.json
│ ├── package.json
│ └── test
│ │ └── index.test.js
├── rax-ssr
│ └── boilerplate
│ │ ├── .eslintrc.js
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── build.json
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── src
│ │ ├── apis
│ │ │ ├── config
│ │ │ │ └── config.default.ts
│ │ │ ├── configuration.ts
│ │ │ └── index.ts
│ │ ├── app.json
│ │ ├── app.ts
│ │ ├── components
│ │ │ └── Logo
│ │ │ │ ├── index.css
│ │ │ │ └── index.tsx
│ │ ├── document
│ │ │ └── index.jsx
│ │ └── pages
│ │ │ └── Home
│ │ │ ├── index.css
│ │ │ └── index.tsx
│ │ └── tsconfig.json
├── rax
│ └── boilerplate
│ │ ├── .eslintrc.js
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── build.json
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── src
│ │ ├── apis
│ │ │ ├── config
│ │ │ │ └── config.default.ts
│ │ │ ├── configuration.ts
│ │ │ └── index.ts
│ │ ├── app.json
│ │ ├── app.ts
│ │ ├── components
│ │ │ └── Logo
│ │ │ │ ├── index.css
│ │ │ │ └── index.tsx
│ │ ├── document
│ │ │ └── index.jsx
│ │ └── pages
│ │ │ └── Home
│ │ │ ├── index.css
│ │ │ └── index.tsx
│ │ └── tsconfig.json
├── rds-mysql
│ ├── README.md
│ ├── boilerplate
│ │ ├── README.md
│ │ ├── _.gitignore
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ ├── index.html
│ │ │ ├── logo192.png
│ │ │ ├── logo512.png
│ │ │ ├── manifest.json
│ │ │ └── robots.txt
│ │ ├── scripts
│ │ │ └── local.js
│ │ ├── src
│ │ │ ├── apis
│ │ │ │ ├── config
│ │ │ │ │ └── config.default.ts
│ │ │ │ ├── configuration.ts
│ │ │ │ └── index.ts
│ │ │ ├── components
│ │ │ │ ├── entry.tsx
│ │ │ │ ├── footer.tsx
│ │ │ │ └── todos.tsx
│ │ │ ├── index.css
│ │ │ ├── index.tsx
│ │ │ ├── react-app-env.d.ts
│ │ │ └── setupProxy.js
│ │ └── tsconfig.json
│ ├── package.json
│ └── test
│ │ └── index.test.js
├── react-covid19
│ ├── README.md
│ ├── boilerplate
│ │ ├── README.md
│ │ ├── _.gitignore
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ ├── index.html
│ │ │ ├── logo192.png
│ │ │ ├── logo512.png
│ │ │ ├── manifest.json
│ │ │ └── robots.txt
│ │ ├── src
│ │ │ ├── App.tsx
│ │ │ ├── Word.tsx
│ │ │ ├── apis
│ │ │ │ ├── config
│ │ │ │ │ └── config.default.ts
│ │ │ │ ├── configuration.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── render.ts
│ │ │ ├── app.css
│ │ │ ├── index.css
│ │ │ ├── index.tsx
│ │ │ ├── react-app-env.d.ts
│ │ │ ├── serviceWorker.ts
│ │ │ ├── setupProxy.js
│ │ │ ├── setupTests.ts
│ │ │ └── word.css
│ │ └── tsconfig.json
│ ├── package.json
│ └── test
│ │ └── index.test.js
├── react
│ ├── README.md
│ ├── boilerplate
│ │ ├── README.md
│ │ ├── _.gitignore
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ ├── index.html
│ │ │ ├── logo192.png
│ │ │ ├── logo512.png
│ │ │ ├── manifest.json
│ │ │ └── robots.txt
│ │ ├── src
│ │ │ ├── App.test.tsx
│ │ │ ├── App.tsx
│ │ │ ├── Detail.tsx
│ │ │ ├── Home.tsx
│ │ │ ├── Layout.tsx
│ │ │ ├── List.tsx
│ │ │ ├── apis
│ │ │ │ ├── config
│ │ │ │ │ └── config.default.ts
│ │ │ │ ├── configuration.ts
│ │ │ │ └── index.ts
│ │ │ ├── common.css
│ │ │ ├── home.css
│ │ │ ├── index.css
│ │ │ ├── index.tsx
│ │ │ ├── layout.css
│ │ │ ├── logo.svg
│ │ │ ├── react-app-env.d.ts
│ │ │ ├── serviceWorker.ts
│ │ │ ├── setupProxy.js
│ │ │ └── setupTests.ts
│ │ └── tsconfig.json
│ ├── package.json
│ └── test
│ │ └── index.test.js
├── vue2
│ ├── README.md
│ ├── boilerplate
│ │ ├── README.md
│ │ ├── _.gitignore
│ │ ├── babel.config.js
│ │ ├── f.yml
│ │ ├── package.json
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ └── index.html
│ │ ├── src
│ │ │ ├── App.vue
│ │ │ ├── apis
│ │ │ │ ├── config
│ │ │ │ │ └── config.default.ts
│ │ │ │ ├── configuration.ts
│ │ │ │ └── index.ts
│ │ │ ├── assets
│ │ │ │ └── logo.png
│ │ │ ├── components
│ │ │ │ └── HelloWorld.vue
│ │ │ ├── main.ts
│ │ │ ├── shims-tsx.d.ts
│ │ │ └── shims-vue.d.ts
│ │ ├── test
│ │ │ └── index.test.ts
│ │ ├── tsconfig.json
│ │ └── vue.config.js
│ ├── package.json
│ └── test
│ │ └── index.test.js
└── vue3
│ ├── README.md
│ ├── boilerplate
│ ├── README.md
│ ├── _.gitignore
│ ├── babel.config.js
│ ├── f.yml
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ └── index.html
│ ├── src
│ │ ├── App.vue
│ │ ├── apis
│ │ │ ├── config
│ │ │ │ └── config.default.ts
│ │ │ ├── configuration.ts
│ │ │ └── index.ts
│ │ ├── assets
│ │ │ └── logo.png
│ │ ├── components
│ │ │ └── HelloWorld.vue
│ │ └── main.js
│ ├── test
│ │ └── index.test.ts
│ ├── tsconfig.json
│ └── vue.config.js
│ ├── package.json
│ └── test
│ └── index.test.js
├── lerna.json
├── migration
├── eggjs
│ ├── README.md
│ ├── boilerplate
│ │ ├── README.md
│ │ ├── _.autod.conf.js
│ │ ├── _.eslintignore
│ │ ├── _.eslintrc
│ │ ├── _.gitignore
│ │ ├── app
│ │ │ ├── controller
│ │ │ │ └── home.js
│ │ │ └── router.js
│ │ ├── config
│ │ │ ├── config.default.js
│ │ │ └── plugin.js
│ │ ├── f.yml
│ │ ├── package.json
│ │ └── test
│ │ │ └── app
│ │ │ └── controller
│ │ │ └── home.test.js
│ ├── package.json
│ └── test
│ │ └── index.test.js
├── express
│ ├── README.md
│ ├── boilerplate
│ │ ├── README.md
│ │ ├── app.js
│ │ ├── f.yml
│ │ └── package.json
│ ├── package.json
│ └── test
│ │ └── index.test.js
└── koa
│ ├── README.md
│ ├── boilerplate
│ ├── README.md
│ ├── app.js
│ ├── f.yml
│ └── package.json
│ ├── package.json
│ └── test
│ └── index.test.js
├── package.json
└── tencent
├── demo-faas-apigw
├── README.md
├── f.yml
├── package.json
├── src
│ └── index.ts
├── test
│ └── index.test.ts
└── tsconfig.json
├── demo-faas-mq
├── README.md
├── f.yml
├── package.json
├── src
│ └── index.ts
├── test
│ └── index.test.ts
└── tsconfig.json
├── demo-faas-os
├── README.md
├── f.yml
├── package.json
├── src
│ └── index.ts
├── test
│ └── index.test.ts
└── tsconfig.json
└── demo-faas-timer
├── README.md
├── f.yml
├── package.json
├── src
└── index.ts
├── test
└── index.test.ts
└── tsconfig.json
/.gitignore:
--------------------------------------------------------------------------------
1 | .serverless
2 | .faas_debug_tmp
3 | node_modules
4 | *.zip
5 | .DS_Store
6 | package-lock.json
7 | .vscode
8 | *.log
9 | integration/todo-antd-umi-mysql
10 | build
11 | .idea
12 |
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | trailingComma: 'es5',
3 | tabWidth: 2,
4 | useTabs: false,
5 | semi: true,
6 | singleQuote: true,
7 | jsxSingleQuote: false,
8 | bracketSpacing: true,
9 | jsxBracketSameLine: false,
10 | arrowParens: 'always',
11 | printWidth: 120,
12 | }
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless Examples
2 |
3 | Directory Detail.
4 |
5 | - [`aliyun`](./aliyun): some demo for aliyun cloud function trigger
6 | - [`tencent`](./tencent): some demo for tencent cloud function trigger
7 | - [`integration`](./integration): some integration demo with frontend framework like react, vue...
8 | - [`framework`](./framework): framework ability like with egg plugin...
9 | - [`migration`](./migration): migration application to serverles...
--------------------------------------------------------------------------------
/aliyun/demo-aggregation/.gitignore:
--------------------------------------------------------------------------------
1 | .serverless
2 | node_modules
3 | *.zip
--------------------------------------------------------------------------------
/aliyun/demo-aggregation/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless
2 |
3 | ## 快速开始
4 |
5 | > 国内用户建议使用 `cnpm` 加速npm,`npm install -g cnpm --registry=https://registry.npm.taobao.org`
6 |
7 |
8 | ### 第一步:安装 serverless
9 |
10 | ```shell script
11 | npm i -g serverless
12 | ```
13 |
14 | ### 第二步:创建项目
15 |
16 | ```shell script
17 | $ serverless install --url https://github.com/midwayjs/midway-faas-examples/tree/master/demo-faas
18 | ```
19 |
20 | ### 第三步:进入目录
21 |
22 | ```shell script
23 | $ cd demo-faas
24 | ```
25 |
26 | ### 第四步:安装npm依赖
27 |
28 | ```shell script
29 | $ npm i
30 | ```
31 |
32 | ## 如何使用?
33 |
34 | [Midway Serverlesss](https://github.com/midwayjs/midway)
35 |
--------------------------------------------------------------------------------
/aliyun/demo-aggregation/f.yml:
--------------------------------------------------------------------------------
1 | service: serverless-midway-faas
2 |
3 | provider:
4 | name: ''
5 |
6 | functions:
7 | index:
8 | handler: index.handler
9 | events:
10 | - http:
11 | path: /api/index
12 | method: get
13 | hello:
14 | handler: hello.handler
15 | events:
16 | - http:
17 | path: /api/hello
18 | method: get
19 |
20 | aggregation:
21 | common:
22 | deployOrigin: false
23 | functions:
24 | - index
25 | - hello
26 |
27 | custom:
28 | customDomain:
29 | domainName: your.domain.example.com
30 |
31 | plugins:
32 | - serverless-midway-plugin
33 |
34 | package:
35 | artifact: midwayFaas.zip
36 |
--------------------------------------------------------------------------------
/aliyun/demo-aggregation/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@aliyun/demo-aggregation",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Aliyun",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "aliyun",
11 | "midway"
12 | ],
13 | "dependencies": {
14 | "@midwayjs/faas": "^1.0.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/aliyun/demo-aggregation/src/hello.ts:
--------------------------------------------------------------------------------
1 | import { FaaSContext, func, inject, provide } from '@midwayjs/faas';
2 |
3 | @provide()
4 | @func('hello.handler')
5 | export class HelloService {
6 |
7 | @inject()
8 | ctx: FaaSContext; // context
9 |
10 | async handler() {
11 | return 'hello.handler';
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/aliyun/demo-aggregation/src/index.ts:
--------------------------------------------------------------------------------
1 | import { FaaSContext, func, inject, provide } from '@midwayjs/faas';
2 |
3 | @provide()
4 | @func('index.handler')
5 | export class IndexService {
6 |
7 | @inject()
8 | ctx: FaaSContext; // context
9 |
10 | async handler() {
11 | return 'index.handler';
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/aliyun/demo-aggregation/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 | const servicePath = join(__dirname, '../');
5 |
6 | describe('/test/invokeAliyun/test/invoke.test.ts', () => {
7 | it('invoke', async () => {
8 | const result: any = await invoke({
9 | functionName: 'index',
10 | functionDir: servicePath
11 | });
12 | assert(/hello world/.test(result.body));
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/aliyun/demo-aggregation/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/aliyun/demo-egg-layer/.gitignore:
--------------------------------------------------------------------------------
1 | .serverless
2 | node_modules
3 | *.zip
--------------------------------------------------------------------------------
/aliyun/demo-egg-layer/app/controller/home.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const Controller = require('egg').Controller;
4 |
5 | class HomeController extends Controller {
6 | async index() {
7 | const { ctx } = this;
8 | ctx.body = 'hi, egg';
9 | }
10 | async buffer() {
11 | const { ctx } = this;
12 | ctx.set('x-res', 'buffer');
13 | // assert
14 | ctx.body = Buffer.from('hi, egg');
15 | }
16 | }
17 |
18 | module.exports = HomeController;
19 |
--------------------------------------------------------------------------------
/aliyun/demo-egg-layer/app/router.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /**
4 | * @param {Egg.Application} app - egg application
5 | */
6 | module.exports = app => {
7 | const { router, controller } = app;
8 | router.get('/', controller.home.index);
9 | router.get('/buffer', controller.home.buffer);
10 | };
11 |
--------------------------------------------------------------------------------
/aliyun/demo-egg-layer/config/config.default.js:
--------------------------------------------------------------------------------
1 | /* eslint valid-jsdoc: "off" */
2 |
3 | 'use strict';
4 |
5 | /**
6 | * @param {Egg.EggAppInfo} appInfo app info
7 | */
8 | module.exports = appInfo => {
9 | /**
10 | * built-in config
11 | * @type {Egg.EggAppConfig}
12 | **/
13 | const config = exports = {};
14 |
15 | // use for cookie sign key, should change to your own and keep security
16 | config.keys = appInfo.name + '_1574154057813_8098';
17 |
18 | // add your middleware config here
19 | config.middleware = [];
20 |
21 | // add your user config here
22 | const userConfig = {
23 | // myAppName: 'egg',
24 | };
25 |
26 | return {
27 | ...config,
28 | ...userConfig,
29 | };
30 | };
31 |
--------------------------------------------------------------------------------
/aliyun/demo-egg-layer/config/plugin.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /** @type Egg.EggPlugin */
4 | module.exports = {
5 | // had enabled by egg
6 | // static: {
7 | // enable: true,
8 | // }
9 | };
10 |
--------------------------------------------------------------------------------
/aliyun/demo-egg-layer/f.yml:
--------------------------------------------------------------------------------
1 |
2 | functions:
3 | index:
4 | handler: index.handler
5 | events:
6 | - http:
7 | method: get
8 | layers:
9 | eggLayer:
10 | path: 'npm:@midwayjs/egg-layer'
11 | package:
12 | include:
13 | - app/**
14 | - config/**
15 | - app.js
16 | - agent.js
17 | - index.js
18 | artifact: midwayFaas.zip
19 | plugins:
20 | - serverless-midway-plugin
21 | provider:
22 | name: aliyun
23 | service:
24 | name: serverless-midway-faas
25 |
--------------------------------------------------------------------------------
/aliyun/demo-egg-layer/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const { asyncWrapper, start } = require('@midwayjs/serverless-fc-starter');
4 | const eggLayer = require('@midwayjs/egg-layer');
5 |
6 | let runtime;
7 | let inited = false;
8 |
9 | const initializeMethod = async (config = {}) => {
10 | runtime = await start({
11 | layers: [eggLayer],
12 | });
13 | inited = true;
14 | };
15 |
16 | exports.initializer = asyncWrapper(async ({ config } = {}) => {
17 | await initializeMethod(config);
18 | });
19 |
20 | exports.handler = asyncWrapper(async (...args) => {
21 | if (!inited) {
22 | await initializeMethod();
23 | }
24 |
25 | return runtime.asyncEvent()(...args);
26 | });
--------------------------------------------------------------------------------
/aliyun/demo-egg-layer/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 | const servicePath = join(__dirname, '../');
5 |
6 | describe('/test/invokeAliyun/test/invoke.test.ts', () => {
7 | it('invoke', async () => {
8 | const result: any = await invoke({
9 | functionName: 'index',
10 | functionDir: servicePath
11 | });
12 | assert(/hello world/.test(result.body));
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-apigw/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless 空触发器示例
2 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-apigw/f.yml:
--------------------------------------------------------------------------------
1 | service:
2 | name: midway-faas-examples
3 |
4 | provider:
5 | name: aliyun
6 |
7 | functions:
8 | apiGatewayTrigger:
9 | handler: index.handler
10 | events:
11 | - apigw: ## api 网关暂时不支持配置,这里写了只是为了本地测试
12 | method: get
13 | path: /api
14 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-apigw/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@aliyun/demo-faas-apigw",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Aliyun",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "midway"
11 | ],
12 | "dependencies": {
13 | "@midwayjs/faas": "^1.0.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-apigw/src/index.ts:
--------------------------------------------------------------------------------
1 | import { Func, Inject, Provide } from '@midwayjs/decorator';
2 | import { FaaSContext, FunctionHandler} from '@midwayjs/faas';
3 |
4 | @Provide()
5 | @Func('index.handler')
6 | export class IndexService implements FunctionHandler {
7 |
8 | @Inject()
9 | ctx: FaaSContext; // context
10 |
11 | async handler() {
12 | this.ctx.set('x-midway-faas-type', '444444')
13 | return {
14 | headers: this.ctx.headers,
15 | method: this.ctx.method,
16 | path: this.ctx.path,
17 | body: this.ctx.request.body,
18 | params: this.ctx.params
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/aliyun/demo-faas-apigw/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-http/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless 空触发器示例
2 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-http/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@aliyun/demo-faas-http",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Aliyun",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "midway"
11 | ],
12 | "dependencies": {
13 | "@midwayjs/faas": "^1.0.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-http/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/serverless-invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 |
5 | describe('/test/index.test.ts', () => {
6 | it('invoke', async () => {
7 | const result: any = await invoke({
8 | functionName: 'index',
9 | functionDir: join(__dirname, '../'),
10 | data: [
11 | {
12 | path: '/tesbbbt',
13 | queries: {
14 | a: 1
15 | },
16 | body: {
17 | name: 'test'
18 | }
19 | }
20 | ],
21 | });
22 | assert(/hello world/.test(JSON.stringify(result)));
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-http/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-log/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless
2 |
3 | ## 快速开始
4 |
5 | > 国内用户建议使用 `cnpm` 加速npm,`npm install -g cnpm --registry=https://registry.npm.taobao.org`
6 |
7 |
8 | ### 第一步:安装 serverless
9 |
10 | ```shell script
11 | npm i -g serverless
12 | ```
13 |
14 | ### 第二步:创建项目
15 |
16 | ```shell script
17 | $ serverless install --url https://github.com/midwayjs/midway-faas-examples/tree/master/demo-faas
18 | ```
19 |
20 | ### 第三步:进入目录
21 |
22 | ```shell script
23 | $ cd demo-faas
24 | ```
25 |
26 | ### 第四步:安装npm依赖
27 |
28 | ```shell script
29 | $ npm i
30 | ```
31 |
32 | ## 如何使用?
33 |
34 | [Midway Serverlesss](https://github.com/midwayjs/midway)
35 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-log/f.yml:
--------------------------------------------------------------------------------
1 | service: midway-faas-examples
2 |
3 | provider:
4 | name: aliyun
5 |
6 | functions:
7 | index:
8 | handler: index.handler
9 | events:
10 | - log:
11 | source: logstore1 # required
12 | retryTime: 1 # default is 1
13 | interval: 20 # default is 30
14 | project: test # required
15 | log: logstore # required
16 | role: 'acs:ram::1234567890:role/fc-invoke-test' # option
17 | version: 'LATEST' # option
18 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-log/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@aliyun/demo-faas-event-log",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Aliyun",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "aliyun",
11 | "midway"
12 | ],
13 | "dependencies": {
14 | "@midwayjs/faas": "^1.0.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-log/src/index.ts:
--------------------------------------------------------------------------------
1 | import { FaaSContext, func, inject, provide } from '@midwayjs/faas';
2 |
3 | @provide()
4 | @func('index.handler')
5 | export class HelloService {
6 |
7 | @inject()
8 | ctx: FaaSContext; // context
9 |
10 | async handler(event) {
11 | return 'hello world';
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-log/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/serverless-invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 | const servicePath = join(__dirname, '../');
5 |
6 | describe('/test/invokeAliyun/test/invoke.test.ts', () => {
7 | it('invoke', async () => {
8 | const result: any = await invoke({
9 | functionName: 'index',
10 | functionDir: servicePath
11 | });
12 | assert(/hello world/.test(result.body));
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-log/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-mq/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless
2 |
3 | ## 快速开始
4 |
5 | > 国内用户建议使用 `cnpm` 加速npm,`npm install -g cnpm --registry=https://registry.npm.taobao.org`
6 |
7 |
8 | ### 第一步:安装 serverless
9 |
10 | ```shell script
11 | npm i -g serverless
12 | ```
13 |
14 | ### 第二步:创建项目
15 |
16 | ```shell script
17 | $ serverless install --url https://github.com/midwayjs/midway-faas-examples/tree/master/demo-faas
18 | ```
19 |
20 | ### 第三步:进入目录
21 |
22 | ```shell script
23 | $ cd demo-faas
24 | ```
25 |
26 | ### 第四步:安装npm依赖
27 |
28 | ```shell script
29 | $ npm i
30 | ```
31 |
32 | ## 如何使用?
33 |
34 | [Midway Serverlesss](https://github.com/midwayjs/midway)
35 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-mq/f.yml:
--------------------------------------------------------------------------------
1 | service: midway-faas-examples
2 |
3 | provider:
4 | name: aliyun
5 |
6 | functions:
7 | mqTrigger:
8 | handler: mq.handler
9 | events:
10 | - mq:
11 | topic: test-topic
12 |
13 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-mq/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@aliyun/demo-faas-event-mq",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Aliyun",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "aliyun",
11 | "midway"
12 | ],
13 | "dependencies": {
14 | "@midwayjs/faas": "^1.0.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-mq/src/index.ts:
--------------------------------------------------------------------------------
1 | import { FaaSContext, FC } from '@midwayjs/faas';
2 | import { Func, Inject, Provide } from '@midwayjs/decorator';
3 |
4 | @Provide()
5 | export class TimerTriggerTest {
6 |
7 | @Inject()
8 | ctx: FaaSContext;
9 |
10 | @Func('mq.handler')
11 | async cronHandler(event: FC.MNSEvent) {
12 | return 'hello world';
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-mq/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/serverless-invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 |
5 | describe('/test/invokeAliyun/test/invoke.test.ts', () => {
6 | it('invoke', async () => {
7 | const result: any = await invoke({
8 | functionName: 'mqTrigger',
9 | functionDir: join(__dirname, '../')
10 | });
11 | assert(/hello world/.test(result.body));
12 | });
13 | });
14 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-mq/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-no-event/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless 空触发器示例
2 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-no-event/f.yml:
--------------------------------------------------------------------------------
1 | service:
2 | name: midway-faas-examples
3 |
4 | provider:
5 | name: aliyun
6 |
7 | functions:
8 | emptyTrigger:
9 | handler: index.handler
10 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-no-event/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@aliyun/demo-faas",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Aliyun",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "midway"
11 | ],
12 | "dependencies": {
13 | "@midwayjs/faas": "^1.0.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-no-event/src/index.ts:
--------------------------------------------------------------------------------
1 | import { Func, Inject, Provide } from '@midwayjs/decorator';
2 | import { FaaSContext, FunctionHandler } from '@midwayjs/faas';
3 |
4 | @Provide()
5 | @Func('index.handler')
6 | export class IndexService implements FunctionHandler {
7 |
8 | @Inject()
9 | ctx: FaaSContext;
10 |
11 | async handler(event: {name: string}) {
12 | return 'hello world ' + event.name;
13 | }
14 | }
--------------------------------------------------------------------------------
/aliyun/demo-faas-no-event/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/serverless-invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 |
5 | describe('/test/index.test.ts', () => {
6 | it('invoke', async () => {
7 | const result: any = await invoke({
8 | functionName: 'emptyTrigger',
9 | functionDir: join(__dirname, '../'),
10 | data: [ {
11 | name: 'faas'
12 | }],
13 | });
14 | assert(/hello world faas/.test(result));
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-no-event/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-os/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless
2 |
3 | ## 快速开始
4 |
5 | > 国内用户建议使用 `cnpm` 加速npm,`npm install -g cnpm --registry=https://registry.npm.taobao.org`
6 |
7 |
8 | ### 第一步:安装 serverless
9 |
10 | ```shell script
11 | npm i -g serverless
12 | ```
13 |
14 | ### 第二步:创建项目
15 |
16 | ```shell script
17 | $ serverless install --url https://github.com/midwayjs/midway-faas-examples/tree/master/demo-faas
18 | ```
19 |
20 | ### 第三步:进入目录
21 |
22 | ```shell script
23 | $ cd demo-faas
24 | ```
25 |
26 | ### 第四步:安装npm依赖
27 |
28 | ```shell script
29 | $ npm i
30 | ```
31 |
32 | ## 如何使用?
33 |
34 | [Midway Serverlesss](https://github.com/midwayjs/midway)
35 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-os/f.yml:
--------------------------------------------------------------------------------
1 | service: midway-faas-examples
2 |
3 | provider:
4 | name: aliyun
5 |
6 | functions:
7 | index:
8 | handler: index.handler
9 | events:
10 | - os: # os | oss | cos
11 | bucket: testoss
12 | events:
13 | - oss:ObjectCreated:PutObject
14 | filter:
15 | prefix: source/
16 | suffix: .png
17 | role: 'acs:ram::1234567890:role/fc-invoke-test'
18 | version: 'LATEST'
19 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-os/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@aliyun/demo-faas-event-os",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Aliyun",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "aliyun",
11 | "midway"
12 | ],
13 | "dependencies": {
14 | "@midwayjs/faas": "^1.0.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-os/src/index.ts:
--------------------------------------------------------------------------------
1 | import { FaaSContext, func, inject, provide } from '@midwayjs/faas';
2 |
3 | @provide()
4 | @func('index.handler')
5 | export class HelloService {
6 |
7 | @inject()
8 | ctx: FaaSContext; // context
9 |
10 | async handler(event) {
11 | return 'hello world';
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-os/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/serverless-invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 | const servicePath = join(__dirname, '../');
5 |
6 | describe('/test/invokeAliyun/test/invoke.test.ts', () => {
7 | it('invoke', async () => {
8 | const result: any = await invoke({
9 | functionName: 'index',
10 | functionDir: servicePath
11 | });
12 | assert(/hello world/.test(result.body));
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-os/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-timer/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless
2 |
3 | ## 快速开始
4 |
5 | > 国内用户建议使用 `cnpm` 加速npm,`npm install -g cnpm --registry=https://registry.npm.taobao.org`
6 |
7 |
8 | ### 第一步:安装 serverless
9 |
10 | ```shell script
11 | npm i -g serverless
12 | ```
13 |
14 | ### 第二步:创建项目
15 |
16 | ```shell script
17 | $ serverless install --url https://github.com/midwayjs/midway-faas-examples/tree/master/demo-faas
18 | ```
19 |
20 | ### 第三步:进入目录
21 |
22 | ```shell script
23 | $ cd demo-faas
24 | ```
25 |
26 | ### 第四步:安装npm依赖
27 |
28 | ```shell script
29 | $ npm i
30 | ```
31 |
32 | ## 如何使用?
33 |
34 | [Midway Serverlesss](https://github.com/midwayjs/midway)
35 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-timer/f.yml:
--------------------------------------------------------------------------------
1 | service: midway-faas-examples
2 |
3 | provider:
4 | name: aliyun
5 |
6 | functions:
7 | everyTimerTrigger:
8 | handler: every.handler
9 | events:
10 | - timer:
11 | type: every
12 | value: 1m # 每隔一分钟
13 | payload: 'awesome-fc'
14 | cronTimerTrigger:
15 | handler: cron.handler
16 | events:
17 | - timer:
18 | type: cron
19 | value: '0 0 4 * * *' # 每天4:00触发 https://help.aliyun.com/document_detail/68172.html
20 | payload: 'awesome-fc'
21 |
22 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-timer/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@aliyun/demo-faas-event-schedule",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Aliyun",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "aliyun",
11 | "midway"
12 | ],
13 | "dependencies": {
14 | "@midwayjs/faas": "^1.0.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-timer/src/index.ts:
--------------------------------------------------------------------------------
1 | import { FaaSContext, FC } from '@midwayjs/faas';
2 | import { Func, Inject, Provide } from '@midwayjs/decorator';
3 |
4 | @Provide()
5 | export class TimerTriggerTest {
6 |
7 | @Inject()
8 | ctx: FaaSContext; // context
9 |
10 | @Func('every.handler')
11 | async everyHandler(event: FC.TimerEvent) {
12 | return 'hello world';
13 | }
14 |
15 | @Func('cron.handler')
16 | async cronHandler(event: FC.TimerEvent) {
17 | return 'hello world';
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-timer/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/serverless-invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 |
5 | describe('/test/invokeAliyun/test/invoke.test.ts', () => {
6 | it('invoke', async () => {
7 | const result: any = await invoke({
8 | functionName: 'everyTimerTrigger',
9 | functionDir: join(__dirname, '../')
10 | });
11 | assert(/hello world/.test(result.body));
12 | });
13 | });
14 |
--------------------------------------------------------------------------------
/aliyun/demo-faas-timer/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/aliyun/demo-image/.gitignore:
--------------------------------------------------------------------------------
1 | .serverless
2 | node_modules
3 | *.zip
--------------------------------------------------------------------------------
/aliyun/demo-image/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless
2 |
3 | ## 快速开始
4 |
5 | > 国内用户建议使用 `cnpm` 加速npm,`npm install -g cnpm --registry=https://registry.npm.taobao.org`
6 |
7 |
8 | ### 第一步:安装 serverless
9 |
10 | ```shell script
11 | npm i -g serverless
12 | ```
13 |
14 | ### 第二步:创建项目
15 |
16 | ```shell script
17 | $ serverless install --url https://github.com/midwayjs/midway-faas-examples/tree/master/demo-faas
18 | ```
19 |
20 | ### 第三步:进入目录
21 |
22 | ```shell script
23 | $ cd demo-faas
24 | ```
25 |
26 | ### 第四步:安装npm依赖
27 |
28 | ```shell script
29 | $ npm i
30 | ```
31 |
32 | ## 如何使用?
33 |
34 | [Midway Serverlesss](https://github.com/midwayjs/midway)
35 |
--------------------------------------------------------------------------------
/aliyun/demo-image/f.yml:
--------------------------------------------------------------------------------
1 | service: serverless-midway-demo-image
2 |
3 | provider:
4 | name: 'aliyun'
5 |
6 | functions:
7 | index:
8 | handler: index.handler
9 | events:
10 | - http:
11 | path: /image/*
12 | method: get
13 |
14 | package:
15 | include:
16 | - public
17 | artifact: code.zip
--------------------------------------------------------------------------------
/aliyun/demo-image/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@aliyun/demo-image",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Aliyun",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "aliyun",
11 | "midway"
12 | ],
13 | "dependencies": {
14 | "@midwayjs/faas": "^1.0.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/aliyun/demo-image/public/midway.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/aliyun/demo-image/public/midway.png
--------------------------------------------------------------------------------
/aliyun/demo-image/src/index.ts:
--------------------------------------------------------------------------------
1 | import { FaaSContext } from '@midwayjs/faas';
2 | import { Func, Inject, Provide } from '@midwayjs/decorator';
3 | import { readFileSync } from 'fs';
4 | import { join } from 'path';
5 | @Provide()
6 | export class IndexService {
7 |
8 | @Inject()
9 | ctx: FaaSContext; // context
10 |
11 | @Inject()
12 | baseDir: string;
13 |
14 | @Func('index.handler')
15 | async handler() {
16 | this.ctx.type = 'image/png';
17 | this.ctx.body = readFileSync(join(this.baseDir, '../public/midway.png'));
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/aliyun/demo-image/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 | const servicePath = join(__dirname, '../');
5 |
6 | describe('/test/invokeAliyun/test/invoke.test.ts', () => {
7 | it('invoke', async () => {
8 | const result: any = await invoke({
9 | functionName: 'index',
10 | functionDir: servicePath
11 | });
12 | assert(/hello world/.test(result.body));
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/aliyun/demo-image/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/framework/egg-mysql/boilerplate/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with egg-mysql plugin
2 |
3 | midway faas + egg-mysql
--------------------------------------------------------------------------------
/framework/egg-mysql/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | service:
2 | name: midway-faas-examples
3 |
4 | provider:
5 | name: aliyun
6 |
7 | functions:
8 | index:
9 | handler: index.handler
10 | events:
11 | - http:
12 | method: get
13 | path: /*
14 |
--------------------------------------------------------------------------------
/framework/egg-mysql/boilerplate/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "midway-demo-with-egg-mysql",
3 | "private": true,
4 | "version": "1.0.0",
5 | "description": "Midway Serverless Template with egg-mysql",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "midway"
11 | ],
12 | "dependencies": {
13 | "@midwayjs/faas": "^1.0.0",
14 | "@midwayjs-component/egg": "^1.0.0",
15 | "egg-mysql": "^3.0.0"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/framework/egg-mysql/boilerplate/src/config/config.default.ts:
--------------------------------------------------------------------------------
1 | export const mysql = {
2 | // 数据库信息配置
3 | client: {
4 | // host
5 | host: '127.0.0.1',
6 | // 端口号
7 | port: '3306',
8 | // 用户名
9 | user: 'xxxx',
10 | // 密码
11 | password: '123456',
12 | // 数据库名
13 | database: 'MY_APP',
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/framework/egg-mysql/boilerplate/src/config/plugin.ts:
--------------------------------------------------------------------------------
1 | export const mysql = {
2 | enable: true,
3 | package: 'egg-mysql',
4 | };
--------------------------------------------------------------------------------
/framework/egg-mysql/boilerplate/src/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration, Plugin } from '@midwayjs/decorator';
2 | import * as assert from 'assert';
3 |
4 | @Configuration({
5 | imports: ['@midwayjs-component/egg'],
6 | importConfigs: [
7 | './config/'
8 | ]
9 | })
10 | export class ContainerConfiguration {
11 |
12 | @Plugin()
13 | mysql;
14 |
15 | async onReady() {
16 | // 这里可以拿到 egg-mysql 实例
17 | assert(this.mysql);
18 | }
19 | }
--------------------------------------------------------------------------------
/framework/egg-mysql/boilerplate/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/framework/egg-mysql/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/faas-with-egg-mysql",
3 | "version": "1.0.1",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/framework/egg-mysql/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/integration/antd/README.md:
--------------------------------------------------------------------------------
1 | # midway serverless + antd
2 |
3 | midway serverless + antd 示例
4 |
--------------------------------------------------------------------------------
/integration/antd/boilerplate/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/integration/antd/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | # f.yml document https://www.yuque.com/midwayjs/faas/serverless_yml
2 |
3 | service: midway-faas-antd-demo
4 |
5 | provider:
6 | name: aliyun # tencent
7 | runtime: nodejs10
8 |
9 | functions:
10 | render:
11 | handler: api.render
12 | events:
13 | - http:
14 | path: /*
15 | list:
16 | handler: api.list
17 | events:
18 | - http:
19 | path: /api/list
20 |
21 |
22 | ## aggregation deplpy
23 | aggregation:
24 | agg-demo-all:
25 | deployOrigin: false
26 | functionsPattern:
27 | - '*'
28 |
29 | package:
30 | include:
31 | - build
32 | artifact: code.zip
--------------------------------------------------------------------------------
/integration/antd/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/antd/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/antd/boilerplate/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/antd/boilerplate/public/logo192.png
--------------------------------------------------------------------------------
/integration/antd/boilerplate/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/antd/boilerplate/public/logo512.png
--------------------------------------------------------------------------------
/integration/antd/boilerplate/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/integration/antd/boilerplate/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/antd/boilerplate/src/App.css:
--------------------------------------------------------------------------------
1 | @import '~antd/dist/antd.css';
2 | .App {
3 | text-align: center;
4 | }
5 | .logo {
6 | color: #fff;
7 | font-size: 18px;
8 | font-weight: bold;
9 | }
--------------------------------------------------------------------------------
/integration/antd/boilerplate/src/App.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import App from './App';
4 |
5 | test('renders learn react link', () => {
6 | const { getByText } = render();
7 | const linkElement = getByText(/learn react/i);
8 | expect(linkElement).toBeInTheDocument();
9 | });
10 |
--------------------------------------------------------------------------------
/integration/antd/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 | return exports;
11 | };
--------------------------------------------------------------------------------
/integration/antd/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: [
5 | './config/'
6 | ],
7 | imports: [
8 | '@midwayjs/faas-middleware-static-file'
9 | ]
10 | })
11 | export class ContainerConfiguration {}
--------------------------------------------------------------------------------
/integration/antd/boilerplate/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/integration/antd/boilerplate/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(
8 |
9 |
10 | ,
11 | document.getElementById('root')
12 | );
13 |
14 | // If you want your app to work offline and load faster, you can change
15 | // unregister() to register() below. Note this comes with some pitfalls.
16 | // Learn more about service workers: https://bit.ly/CRA-PWA
17 | serviceWorker.unregister();
18 |
--------------------------------------------------------------------------------
/integration/antd/boilerplate/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/integration/antd/boilerplate/src/setupProxy.js:
--------------------------------------------------------------------------------
1 | // @ts-ignore: isolated modules error
2 | const { useExpressDevPack } = require('@midwayjs/faas-dev-pack');
3 | const { resolve } = require('path');
4 | const URL = require('url');
5 |
6 | module.exports = function (app) {
7 | app.use(
8 | useExpressDevPack({
9 | functionDir: resolve(__dirname, '../'),
10 | sourceDir: resolve(__dirname, 'apis'),
11 | // 忽略渲染函数
12 | ignoreWildcardFunctions: ['render'],
13 | // 忽略静态文件地址
14 | ignorePattern: (req) => {
15 | const { pathname } = URL.parse(req.url);
16 | return /\.(js|css|map|json|png|jpg|jpeg|gif|svg|eot|woff2|ttf)$/.test(pathname);
17 | },
18 | })
19 | )
20 | }
21 |
--------------------------------------------------------------------------------
/integration/antd/boilerplate/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom/extend-expect';
6 |
--------------------------------------------------------------------------------
/integration/antd/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/faas-with-antd",
3 | "version": "1.0.0",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/integration/comment/boilerplate/_.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.log
3 | *.log.*
4 | logs
5 | .vscode
6 | dest
7 | dist
8 | coverage
9 | .idea
10 | package-lock.json
11 | .DS_*
12 | .nyc*
13 | run/
14 | package-lock.json
15 | .nodejs-cache
16 | AUTHORS
17 | .serverless
18 | .faas_debug_tmp
19 |
--------------------------------------------------------------------------------
/integration/comment/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | service: midway-commit-demo
2 |
3 | provider:
4 | name: aliyun
5 | runtime: nodejs10
6 |
7 | functions:
8 | render:
9 | handler: render.handler
10 | events:
11 | - http:
12 | path: /*
13 | add:
14 | handler: commit.add
15 | events:
16 | - http:
17 | path: /api/commit-add
18 | list:
19 | handler: list.handler
20 | events:
21 | - http:
22 | path: /api/commit-list
23 |
24 | package:
25 | include:
26 | - static
27 | artifact: code.zip
28 |
29 | aggregation:
30 | agg-demo-all:
31 | deployOrigin: false
32 | functionsPattern:
33 | - '*'
--------------------------------------------------------------------------------
/integration/comment/boilerplate/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "midway-faas-comment-demo",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@midwayjs/faas": "^1.0.0",
7 | "@midwayjs/faas-middleware-static-file": "^1.0.0",
8 | "md5-hex": "^3.0.1",
9 | "nodemailer": "^6.4.13",
10 | "otswhere": "^0.0.4",
11 | "tablestore": "^5.0.7"
12 | },
13 | "scripts": {
14 | "dev": "npx f invoke -p",
15 | "build": "npx f package"
16 | },
17 | "devDependencies": {
18 | "@types/jest": "^24.0.0",
19 | "@types/node": "^12.0.0",
20 | "@midwayjs/faas-cli": "*",
21 | "typescript": "4"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/integration/comment/boilerplate/static/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/ding-robot/README.md:
--------------------------------------------------------------------------------
1 | # midway serverless + 钉钉机器人脚手架
2 |
3 | midway serverless + 钉钉机器人脚手架
4 |
--------------------------------------------------------------------------------
/integration/ding-robot/boilerplate/_.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw?
22 | package-lock.json
23 | .faas_debug_tmp
24 | .serverless
25 | .env_tmp
26 | build
--------------------------------------------------------------------------------
/integration/ding-robot/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | # f.yml document https://www.yuque.com/midwayjs/faas/serverless_yml
2 |
3 | service: midway-faas-ding-robot-demo
4 |
5 | provider:
6 | name: aliyun # tencent
7 | runtime: nodejs10
8 |
9 | functions:
10 | render:
11 | handler: api.render
12 | events:
13 | - http:
14 | path: /*
15 | send:
16 | handler: api.send
17 | events:
18 | - http:
19 | path: /api/send
20 |
21 |
22 | ## aggregation deplpy
23 | aggregation:
24 | agg-demo-all:
25 | deployOrigin: false
26 | functionsPattern:
27 | - '*'
28 |
29 | package:
30 | include:
31 | - build
32 | artifact: code.zip
--------------------------------------------------------------------------------
/integration/ding-robot/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/ding-robot/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/ding-robot/boilerplate/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": ".",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/integration/ding-robot/boilerplate/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/ding-robot/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 | return exports;
11 | };
--------------------------------------------------------------------------------
/integration/ding-robot/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: [
5 | './config/'
6 | ],
7 | imports: [
8 | '@midwayjs/faas-middleware-static-file'
9 | ]
10 | })
11 | export class ContainerConfiguration {}
--------------------------------------------------------------------------------
/integration/ding-robot/boilerplate/src/index.tsx:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react';
3 | import ReactDOM from 'react-dom';
4 | import App from './App';
5 |
6 | ReactDOM.render(
7 |
8 |
9 | ,
10 | document.getElementById('root')
11 | );
--------------------------------------------------------------------------------
/integration/ding-robot/boilerplate/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/integration/ding-robot/boilerplate/src/setupProxy.js:
--------------------------------------------------------------------------------
1 | // @ts-ignore: isolated modules error
2 | const { useExpressDevPack } = require('@midwayjs/faas-dev-pack');
3 | const { resolve } = require('path');
4 | const URL = require('url');
5 |
6 | module.exports = function (app) {
7 | app.use(
8 | useExpressDevPack({
9 | functionDir: resolve(__dirname, '../'),
10 | sourceDir: resolve(__dirname, 'apis'),
11 | // 忽略渲染函数
12 | ignoreWildcardFunctions: ['render'],
13 | // 忽略静态文件地址
14 | ignorePattern: (req) => {
15 | const { pathname } = URL.parse(req.url);
16 | return /\.(js|css|map|json|png|jpg|jpeg|gif|svg|eot|woff2|ttf)$/.test(pathname);
17 | },
18 | })
19 | )
20 | }
21 |
--------------------------------------------------------------------------------
/integration/ding-robot/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/faas-with-dingtalk-robot",
3 | "version": "1.0.0",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/integration/email/boilerplate/_.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.log
3 | *.log.*
4 | logs
5 | .vscode
6 | dest
7 | dist
8 | coverage
9 | .idea
10 | package-lock.json
11 | .DS_*
12 | .nyc*
13 | run/
14 | package-lock.json
15 | .nodejs-cache
16 | AUTHORS
17 | .serverless
18 | .faas_debug_tmp
19 |
--------------------------------------------------------------------------------
/integration/email/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | service: midway-email-demo
2 |
3 | provider:
4 | name: aliyun
5 | runtime: nodejs10
6 |
7 | functions:
8 | render:
9 | handler: render.handler
10 | events:
11 | - http:
12 | path: /*
13 | send:
14 | handler: email.send
15 | events:
16 | - http:
17 | path: /api/send
18 |
19 | package:
20 | include:
21 | - static
22 | artifact: code.zip
23 |
24 | aggregation:
25 | agg-demo-all:
26 | deployOrigin: false
27 | functionsPattern:
28 | - '*'
--------------------------------------------------------------------------------
/integration/email/boilerplate/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "midway-faas-email-demo",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@midwayjs/faas": "^1.0.0",
7 | "@midwayjs/faas-middleware-static-file": "^1.0.0",
8 | "nodemailer": "^6.4.13"
9 | },
10 | "scripts": {
11 | "dev": "npx f invoke -p",
12 | "build": "npx f package"
13 | },
14 | "devDependencies": {
15 | "@types/jest": "^24.0.0",
16 | "@types/node": "^12.0.0",
17 | "@midwayjs/faas-cli": "*",
18 | "typescript": "4"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/integration/email/boilerplate/src/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../static'),
9 | };
10 |
11 | exports.commitConfig = {
12 | admin: process.env.MIDWAY_COMADMIN, // 管理员的email,收到评论时会向这个email发送邮件
13 | limitTime: 20000, // 单ip限流毫秒
14 | mailer: {
15 | host: "smtp.exmail.qq.com",
16 | port: 465,
17 | secure: true,
18 | auth: {
19 | user: process.env.EMAILUSER,
20 | pass: process.env.EMAILPASS
21 | }
22 | }
23 | };
24 | return exports;
25 | };
--------------------------------------------------------------------------------
/integration/email/boilerplate/src/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration, Config } from '@midwayjs/decorator';
2 | const nodemailer = require("nodemailer");
3 |
4 | @Configuration({
5 | importConfigs: [
6 | './config/'
7 | ],
8 | imports: [
9 | '@midwayjs/faas-middleware-static-file'
10 | ]
11 | })
12 | export class ContainerConfiguration {
13 |
14 | @Config()
15 | commitConfig;
16 |
17 | async onReady(container) {
18 |
19 | const mailer = nodemailer.createTransport(this.commitConfig.mailer);
20 | container.registerObject('mailer', mailer);
21 | }
22 | }
--------------------------------------------------------------------------------
/integration/email/boilerplate/static/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/github-contributors/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with react
2 |
3 | midway serverless + react 一体化开发脚手架
4 |
5 | 
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/_.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw?
22 | package-lock.json
23 | .faas_debug_tmp
24 | .serverless
25 | .env_tmp
26 | build
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | # f.yml document https://www.yuque.com/midwayjs/faas/serverless_yml
2 |
3 | service: midway-github-contributors-demo
4 |
5 | provider:
6 | name: aliyun # tencent
7 | runtime: nodejs10
8 |
9 | functions:
10 | list:
11 | handler: api.list
12 | events:
13 | - http:
14 | path: /github-contributors/api/list
15 |
16 |
17 | ## aggregation deplpy
18 | aggregation:
19 | agg-demo-all:
20 | deployOrigin: false
21 | functionsPattern:
22 | - '*'
23 |
24 | package:
25 | include:
26 | - build
27 | artifact: code.zip
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/github-contributors/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/github-contributors/boilerplate/public/logo192.png
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/github-contributors/boilerplate/public/logo512.png
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/src/App.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import App from './App';
4 |
5 | test('renders learn react link', () => {
6 | const { getByText } = render();
7 | const linkElement = getByText(/learn react/i);
8 | expect(linkElement).toBeInTheDocument();
9 | });
10 |
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/src/App.tsx:
--------------------------------------------------------------------------------
1 | import Layout from './Layout';
2 |
3 | export default Layout;
4 |
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/src/Detail.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react';
2 | import './common.css';
3 | export default () => {
4 | const [message, setMessage] = useState('')
5 |
6 | useEffect(() => {
7 | fetch('./api/detail')
8 | .then(resp => resp.json())
9 | .then(({message}) => setMessage(message))
10 | }, [])
11 |
12 |
13 | return (
14 |
15 | { message || 'Loading...' }
16 |
17 | );
18 | }
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 | return exports;
11 | };
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: [
5 | './config/'
6 | ],
7 | imports: [
8 | '@midwayjs/faas-middleware-static-file'
9 | ]
10 | })
11 | export class ContainerConfiguration {}
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/src/common.css:
--------------------------------------------------------------------------------
1 | .common-container {
2 | padding: 24px;
3 | line-height: 24px;
4 | color: #ccc;
5 | }
6 | .common-card {
7 | margin-bottom: 24px;
8 | }
9 | .common-title {
10 | font-size: 15px;
11 | font-weight: bold;
12 | }
13 | a {
14 | color: #fff;
15 | }
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(
8 |
9 |
10 | ,
11 | document.getElementById('root')
12 | );
13 |
14 | // If you want your app to work offline and load faster, you can change
15 | // unregister() to register() below. Note this comes with some pitfalls.
16 | // Learn more about service workers: https://bit.ly/CRA-PWA
17 | serviceWorker.unregister();
18 |
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/src/layout.css:
--------------------------------------------------------------------------------
1 | .layout {
2 | text-align: center;
3 | background-color: #282c34;
4 | min-height: 100vh;
5 | }
6 |
7 | .layout-header {
8 | display: flex;
9 | padding: 12px 0;
10 | flex-direction: row;
11 | align-items: center;
12 | justify-content: center;
13 | font-size: calc(10px + 2vmin);
14 | color: white;
15 | }
16 |
17 | .layout-header-btn {
18 | margin: 0 12px;
19 | opacity: 0.3;
20 | cursor: pointer;
21 | }
22 | .layout-header-btn-current {
23 | opacity: 1;
24 | }
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/integration/github-contributors/boilerplate/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom/extend-expect';
6 |
--------------------------------------------------------------------------------
/integration/hexo/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless Hexo
2 |
3 | Midway Serverless Hexo 博客脚手架
4 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | Thumbs.db
3 | db.json
4 | *.log
5 | node_modules/
6 | public/
7 | .deploy*/
8 | *.log.*
9 | logs
10 | .vscode
11 | dest
12 | dist
13 | coverage
14 | .idea
15 | package-lock.json
16 | .nyc*
17 | run/
18 | package-lock.json
19 | .nodejs-cache
20 | AUTHORS
21 | .serverless
22 | .faas_debug_tmp
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | service:
2 | name: serverless-hexo
3 | provider:
4 | name: aliyun
5 | runtime: nodejs10
6 | functions:
7 | render:
8 | handler: render.handler
9 | events:
10 | - http:
11 | path: /*
12 | package:
13 | include:
14 | - public
15 | artifact: code.zip
16 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/scaffolds/draft.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: {{ title }}
3 | tags:
4 | ---
5 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/scaffolds/page.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: {{ title }}
3 | date: {{ date }}
4 | ---
5 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/scaffolds/post.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: {{ title }}
3 | date: {{ date }}
4 | tags:
5 | ---
6 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/source/_posts/hello-world.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Hello Midway Serverless
3 | ---
4 |
5 | Midway Serverless 是用于构建 Node.js 云函数的 Serverless 框架。帮助您在云原生时代大幅降低维护成本,更专注于产品研发。
6 |
7 | - **跨云厂商:**一份代码可在多个云平台间快速部署,不用担心你的产品会被云厂商所绑定。
8 | - **代码复用:**通过框架的依赖注入能力,让每一部分逻辑单元都天然可复用,可以快速方便地组合以生成复杂的应用。
9 | - **传统迁移:**通过框架的运行时扩展能力,让 Egg.js 、Koa、Express.js 等传统应用无缝迁移至各云厂商的云函数。
10 |
11 |
12 |
Midway Serverless 是阿里巴巴集团发起的开源项目,由一个专业的 Node.js 架构团队进行维护。已大规模应用于阿里集团各 BU 线上业务,稳定承载了数千万的流量。
13 |
14 |
[ ❤️ 欢迎关注 ➡️](https://github.com/midwayjs/midway-faas)
15 |
[ ❤️ 详细文档 ➡️](https://www.yuque.com/midwayjs/faas/quick_start)
16 |
17 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/src/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 | exports.staticFile = {
6 | prefix: '/',
7 | dir: join(appInfo.baseDir, '../public'),
8 | };
9 | return exports;
10 | };
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/src/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: [
5 | './config/'
6 | ],
7 | imports: [
8 | '@midwayjs/faas-middleware-static-file',
9 | ]
10 | })
11 | export class ContainerConfiguration {}
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/src/render.ts:
--------------------------------------------------------------------------------
1 | import { Provide, Func, Inject } from '@midwayjs/decorator'
2 | @Provide()
3 | export class RenderService {
4 |
5 | @Inject()
6 | ctx;
7 |
8 | @Func('render.handler', { middleware: [ 'rewrite', 'fmw:staticFile' ]})
9 | async handler() {
10 | return '404 Error Powered by Midway Serverless';
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | tmp
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/_config.yml:
--------------------------------------------------------------------------------
1 | # Header
2 | menu:
3 | Home: /
4 | Archives: /archives
5 | rss: /atom.xml
6 |
7 | # Content
8 | excerpt_link: Read More
9 | fancybox: true
10 |
11 | # Sidebar
12 | sidebar: right
13 | widgets:
14 | - category
15 | - tag
16 | - tagcloud
17 | - archive
18 | - recent_posts
19 |
20 | # display widgets at the bottom of index pages (pagination == 2)
21 | index_widgets:
22 | # - category
23 | # - tagcloud
24 | # - archive
25 |
26 | # widget behavior
27 | archive_type: 'monthly'
28 | show_count: false
29 |
30 | # Miscellaneous
31 | google_analytics:
32 | gauges_analytics:
33 | favicon: /favicon.png
34 | twitter:
35 | google_plus:
36 | fb_admins:
37 | fb_app_id:
38 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/de.yml:
--------------------------------------------------------------------------------
1 | categories: Kategorien
2 | search: Suche
3 | tags: Tags
4 | tagcloud: Tag Cloud
5 | tweets: Tweets
6 | prev: zurück
7 | next: weiter
8 | comment: Kommentare
9 | archive_a: Archiv
10 | archive_b: "Archive: %s"
11 | page: Seite %d
12 | recent_posts: letzter Beitrag
13 | newer: Neuer
14 | older: Älter
15 | share: Teilen
16 | powered_by: Powered by
17 | rss_feed: RSS Feed
18 | category: Kategorie
19 | tag: Tag
20 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/default.yml:
--------------------------------------------------------------------------------
1 | categories: Categories
2 | search: Search
3 | tags: Tags
4 | tagcloud: Tag Cloud
5 | tweets: Tweets
6 | prev: Prev
7 | next: Next
8 | comment: Comments
9 | archive_a: Archives
10 | archive_b: "Archives: %s"
11 | page: Page %d
12 | recent_posts: Recent Posts
13 | newer: Newer
14 | older: Older
15 | share: Share
16 | powered_by: Powered by
17 | rss_feed: RSS Feed
18 | category: Category
19 | tag: Tag
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/es.yml:
--------------------------------------------------------------------------------
1 | categories: Categorías
2 | search: Buscar
3 | tags: Tags
4 | tagcloud: Nube de Tags
5 | tweets: Tweets
6 | prev: Previo
7 | next: Siguiente
8 | comment: Comentarios
9 | archive_a: Archivos
10 | archive_b: "Archivos: %s"
11 | page: Página %d
12 | recent_posts: Posts recientes
13 | newer: Nuevo
14 | older: Viejo
15 | share: Compartir
16 | powered_by: Construido por
17 | rss_feed: RSS
18 | category: Categoría
19 | tag: Tag
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/fr.yml:
--------------------------------------------------------------------------------
1 | categories: Catégories
2 | search: Rechercher
3 | tags: Mot-clés
4 | tagcloud: Nuage de mot-clés
5 | tweets: Tweets
6 | prev: Précédent
7 | next: Suivant
8 | comment: Commentaires
9 | archive_a: Archives
10 | archive_b: "Archives: %s"
11 | page: Page %d
12 | recent_posts: Articles récents
13 | newer: Récent
14 | older: Ancien
15 | share: Partager
16 | powered_by: Propulsé par
17 | rss_feed: Flux RSS
18 | category: Catégorie
19 | tag: Mot-clé
20 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/ja.yml:
--------------------------------------------------------------------------------
1 | categories: カテゴリ
2 | search: 検索
3 | tags: タグ
4 | tagcloud: タグクラウド
5 | tweets: ツイート
6 | prev: 戻る
7 | next: 次へ
8 | comment: コメント
9 | archive_a: アーカイブ
10 | archive_b: "アーカイブ: %s"
11 | page: ページ %d
12 | recent_posts: 最近の投稿
13 | newer: 次の記事
14 | older: 前の記事
15 | share: 共有
16 | powered_by: Powered by
17 | rss_feed: RSSフィード
18 | category: カテゴリ
19 | tag: タグ
20 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/ko.yml:
--------------------------------------------------------------------------------
1 | categories: 카테고리
2 | search: 검색
3 | tags: 태그
4 | tagcloud: 태그 클라우드
5 | tweets: 트윗
6 | prev: 이전
7 | next: 다음
8 | comment: 댓글
9 | archive_a: 아카이브
10 | archive_b: "아카이브: %s"
11 | page: 페이지 %d
12 | recent_posts: 최근 포스트
13 | newer: 최신
14 | older: 이전
15 | share: 공유
16 | powered_by: Powered by
17 | rss_feed: RSS Feed
18 | category: 카테고리
19 | tag: 태그
20 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/nl.yml:
--------------------------------------------------------------------------------
1 |
2 | categories: Categorieën
3 | search: Zoeken
4 | tags: Labels
5 | tagcloud: Tag Cloud
6 | tweets: Tweets
7 | prev: Vorige
8 | next: Volgende
9 | comment: Commentaren
10 | archive_a: Archieven
11 | archive_b: "Archieven: %s"
12 | page: Pagina %d
13 | recent_posts: Recente berichten
14 | newer: Nieuwer
15 | older: Ouder
16 | share: Delen
17 | powered_by: Powered by
18 | rss_feed: RSS Feed
19 | category: Categorie
20 | tag: Label
21 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/no.yml:
--------------------------------------------------------------------------------
1 | categories: Kategorier
2 | search: Søk
3 | tags: Tags
4 | tagcloud: Tag Cloud
5 | tweets: Tweets
6 | prev: Forrige
7 | next: Neste
8 | comment: Kommentarer
9 | archive_a: Arkiv
10 | archive_b: "Arkiv: %s"
11 | page: Side %d
12 | recent_posts: Siste innlegg
13 | newer: Newer
14 | older: Older
15 | share: Share
16 | powered_by: Powered by
17 | rss_feed: RSS Feed
18 | category: Category
19 | tag: Tag
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/pt.yml:
--------------------------------------------------------------------------------
1 | categories: Categorias
2 | search: Buscar
3 | tags: Tags
4 | tagcloud: Nuvem de Tags
5 | tweets: Tweets
6 | prev: Anterior
7 | next: Próximo
8 | comment: Comentários
9 | archive_a: Arquivos
10 | archive_b: "Arquivos: %s"
11 | page: Página %d
12 | recent_posts: Postagens Recentes
13 | newer: Mais Recente
14 | older: Mais Antigo
15 | share: Compartilhar
16 | powered_by: Desenvolvido por
17 | rss_feed: Feed RSS
18 | category: Categoria
19 | tag: Tag
20 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/ru.yml:
--------------------------------------------------------------------------------
1 | categories: Категории
2 | search: Поиск
3 | tags: Метки
4 | tagcloud: Облако меток
5 | tweets: Твиты
6 | prev: Назад
7 | next: Вперед
8 | comment: Комментарии
9 | archive_a: Архив
10 | archive_b: "Архив: %s"
11 | page: Страница %d
12 | recent_posts: Недавние записи
13 | newer: Следующий
14 | older: Предыдущий
15 | share: Поделиться
16 | powered_by: Создано с помощью
17 | rss_feed: RSS-каналы
18 | category: Категория
19 | tag: Метка
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/zh-CN.yml:
--------------------------------------------------------------------------------
1 | categories: 分类
2 | search: 搜索
3 | tags: 标签
4 | tagcloud: 标签云
5 | tweets: 推文
6 | prev: 上一页
7 | next: 下一页
8 | comment: 留言
9 | archive_a: 归档
10 | archive_b: 归档:%s
11 | page: 第 %d 页
12 | recent_posts: 最新文章
13 | newer: Newer
14 | older: Older
15 | share: Share
16 | powered_by: Powered by
17 | rss_feed: RSS Feed
18 | category: Category
19 | tag: Tag
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/languages/zh-TW.yml:
--------------------------------------------------------------------------------
1 | categories: 分類
2 | search: 搜尋
3 | tags: 標籤
4 | tagcloud: 標籤雲
5 | tweets: 推文
6 | prev: 上一頁
7 | next: 下一頁
8 | comment: 留言
9 | archive_a: 彙整
10 | archive_b: 彙整:%s
11 | page: 第 %d 頁
12 | recent_posts: 最新文章
13 | newer: Newer
14 | older: Older
15 | share: Share
16 | powered_by: Powered by
17 | rss_feed: RSS Feed
18 | category: Category
19 | tag: Tag
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_partial/archive-post.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <%- partial('post/date', {class_name: 'archive-article-date', date_format: 'MMM D'}) %>
5 | <%- partial('post/title', {class_name: 'archive-article-title'}) %>
6 |
7 |
8 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_partial/footer.ejs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_partial/google-analytics.ejs:
--------------------------------------------------------------------------------
1 | <% if (theme.google_analytics){ %>
2 |
3 |
13 |
14 | <% } %>
15 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_partial/mobile-nav.ejs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_partial/post/category.ejs:
--------------------------------------------------------------------------------
1 | <% if (post.categories && post.categories.length){ %>
2 |
3 | <%- list_categories(post.categories, {
4 | show_count: false,
5 | class: 'article-category',
6 | style: 'none',
7 | separator: '►'
8 | }) %>
9 |
10 | <% } %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_partial/post/date.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_partial/post/gallery.ejs:
--------------------------------------------------------------------------------
1 | <% if (post.photos && post.photos.length){ %>
2 |
3 |
4 | <% post.photos.forEach(function(photo, i){ %>
5 |
6 |
7 |
8 | <% }) %>
9 |
10 |
11 | <% } %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_partial/post/tag.ejs:
--------------------------------------------------------------------------------
1 | <% if (post.tags && post.tags.length){ %>
2 | <%- list_tags(post.tags, {
3 | show_count: false,
4 | class: 'article-tag'
5 | }) %>
6 | <% } %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_partial/post/title.ejs:
--------------------------------------------------------------------------------
1 | <% if (post.link){ %>
2 |
5 | <% } else if (post.title){ %>
6 | <% if (index){ %>
7 |
10 | <% } else { %>
11 |
12 | <%= post.title %>
13 |
14 | <% } %>
15 | <% } %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_partial/sidebar.ejs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_widget/archive.ejs:
--------------------------------------------------------------------------------
1 | <% if (site.posts.length){ %>
2 |
8 | <% } %>
9 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_widget/category.ejs:
--------------------------------------------------------------------------------
1 | <% if (site.categories.length){ %>
2 |
8 | <% } %>
9 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_widget/recent_posts.ejs:
--------------------------------------------------------------------------------
1 | <% if (site.posts.length){ %>
2 |
14 | <% } %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_widget/tag.ejs:
--------------------------------------------------------------------------------
1 | <% if (site.tags.length){ %>
2 |
8 | <% } %>
9 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/_widget/tagcloud.ejs:
--------------------------------------------------------------------------------
1 | <% if (site.tags.length){ %>
2 |
8 | <% } %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/archive.ejs:
--------------------------------------------------------------------------------
1 | <%- partial('_partial/archive', {pagination: config.archive, index: true}) %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/category.ejs:
--------------------------------------------------------------------------------
1 | <%- partial('_partial/archive', {pagination: config.category, index: true}) %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/index.ejs:
--------------------------------------------------------------------------------
1 | <%- partial('_partial/archive', {pagination: 2, index: true}) %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/page.ejs:
--------------------------------------------------------------------------------
1 | <%- partial('_partial/article', {post: page, index: false}) %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/post.ejs:
--------------------------------------------------------------------------------
1 | <%- partial('_partial/article', {post: page, index: false}) %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/layout/tag.ejs:
--------------------------------------------------------------------------------
1 | <%- partial('_partial/archive', {pagination: config.tag, index: true}) %>
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hexo-theme-landscape",
3 | "version": "0.0.2",
4 | "private": true,
5 | "devDependencies": {
6 | "grunt": "~0.4.2",
7 | "load-grunt-tasks": "~0.2.0",
8 | "grunt-git": "~0.2.2",
9 | "grunt-contrib-clean": "~0.5.0",
10 | "grunt-contrib-copy": "~0.4.1"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/css/_partial/comment.styl:
--------------------------------------------------------------------------------
1 | #comments
2 | background: #fff
3 | box-shadow: 1px 2px 3px #ddd
4 | padding: article-padding
5 | border: 1px solid color-border
6 | border-radius: 3px
7 | margin: block-margin 0
8 | a
9 | color: color-link
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/css/_partial/footer.styl:
--------------------------------------------------------------------------------
1 | #footer
2 | background: color-footer-background
3 | padding: 50px 0
4 | border-top: 1px solid color-border
5 | color: color-grey
6 | a
7 | color: color-link
8 | text-decoration: none
9 | &:hover
10 | text-decoration: underline
11 |
12 | #footer-info
13 | line-height: line-height
14 | font-size: 0.85em
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/css/_partial/mobile.styl:
--------------------------------------------------------------------------------
1 | @media mq-mobile
2 | #mobile-nav
3 | position: absolute
4 | top: 0
5 | left: 0
6 | width: mobile-nav-width
7 | height: 100%
8 | background: color-mobile-nav-background
9 | border-right: 1px solid #fff
10 |
11 | @media mq-mobile
12 | .mobile-nav-link
13 | display: block
14 | color: color-grey
15 | text-decoration: none
16 | padding: 15px 20px
17 | font-weight: bold
18 | &:hover
19 | color: #fff
20 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/css/_partial/sidebar-aside.styl:
--------------------------------------------------------------------------------
1 | #sidebar
2 | @media mq-normal
3 | column(sidebar-column)
4 |
5 | .widget-wrap
6 | margin: block-margin 0
7 |
8 | .widget-title
9 | @extend $block-caption
10 |
11 | .widget
12 | color: color-sidebar-text
13 | text-shadow: 0 1px #fff
14 | background: color-widget-background
15 | box-shadow: 0 -1px 4px color-widget-border inset
16 | border: 1px solid color-widget-border
17 | padding: 15px
18 | border-radius: 3px
19 | a
20 | color: color-link
21 | text-decoration: none
22 | &:hover
23 | text-decoration: underline
24 | ul, ol, dl
25 | ul, ol, dl
26 | margin-left: 15px
27 | list-style: disc
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/css/_partial/sidebar-bottom.styl:
--------------------------------------------------------------------------------
1 | .widget-wrap
2 | margin-bottom: block-margin !important
3 | @media mq-normal
4 | column(main-column)
5 |
6 | .widget-title
7 | color: #ccc
8 | text-transform: uppercase
9 | letter-spacing: 2px
10 | margin-bottom: .5em
11 | line-height: 1em
12 | font-weight: bold
13 |
14 | .widget
15 | color: color-grey
16 | ul, ol
17 | li
18 | display: inline-block
19 | zoom:1
20 | *display:inline
21 | padding-right: .75em
22 | /* Having problems getting balanced white space between items
23 | li:before
24 | content: " | "
25 | li:first-child:before
26 | content: none
27 | */
28 |
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/css/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/css/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/css/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/css/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/css/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/css/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/css/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/css/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/css/images/banner.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/css/images/banner.jpg
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/fancybox/blank.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/fancybox/blank.gif
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/fancybox/fancybox_loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/fancybox/fancybox_loading.gif
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/fancybox/fancybox_loading@2x.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/fancybox/fancybox_loading@2x.gif
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/fancybox/fancybox_overlay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/fancybox/fancybox_overlay.png
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/fancybox/fancybox_sprite.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/fancybox/fancybox_sprite.png
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/fancybox/fancybox_sprite@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/fancybox/fancybox_sprite@2x.png
--------------------------------------------------------------------------------
/integration/hexo/boilerplate/themes/landscape/source/fancybox/helpers/fancybox_buttons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hexo/boilerplate/themes/landscape/source/fancybox/helpers/fancybox_buttons.png
--------------------------------------------------------------------------------
/integration/hexo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/midway-hexo",
3 | "version": "1.0.9",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/integration/hooks-react/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with React
2 |
3 | Midway Serverless hooks + React 一体化开发脚手架
4 |
5 | 
6 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/.env:
--------------------------------------------------------------------------------
1 | EXTEND_ESLINT=true
2 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw?
22 | package-lock.json
23 | .faas_debug_tmp
24 | .serverless
25 | .env_tmp
26 | build
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/config-overrides.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | webpack: function (config, env) {
3 | config.module.rules.unshift({
4 | test: /\.(js|mjs|jsx|ts|tsx)$/,
5 | use: [
6 | {
7 | loader: require.resolve('@midwayjs/hooks-loader'),
8 | },
9 | ],
10 | })
11 |
12 | return config
13 | },
14 | }
15 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hooks-react/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hooks-react/boilerplate/public/logo192.png
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hooks-react/boilerplate/public/logo512.png
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/src/App.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import App from './App';
4 |
5 | test('renders learn react link', () => {
6 | const { getByText } = render();
7 | const linkElement = getByText(/learn react/i);
8 | expect(linkElement).toBeInTheDocument();
9 | });
10 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 | return exports;
11 | };
12 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: ['./config/'],
5 | imports: ['@midwayjs/faas-middleware-static-file'],
6 | })
7 | export class ContainerConfiguration {}
8 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/src/apis/hook/useMethod.ts:
--------------------------------------------------------------------------------
1 | import { useContext } from '@midwayjs/hooks';
2 |
3 | /**
4 | * Get Request HTTP Method (GET/POST)
5 | */
6 | export function useMethod() {
7 | const { method } = useContext();
8 | return method;
9 | }
10 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/src/apis/render/[...index].ts:
--------------------------------------------------------------------------------
1 | import { withController } from '@midwayjs/hooks';
2 |
3 | export default withController(
4 | {
5 | middleware: ['fmw:staticFile'],
6 | },
7 | async () => {
8 | return 'Building... Please refresh this page later.';
9 | }
10 | );
11 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(
8 |
9 |
10 | ,
11 | document.getElementById('root')
12 | );
13 |
14 | // If you want your app to work offline and load faster, you can change
15 | // unregister() to register() below. Note this comes with some pitfalls.
16 | // Learn more about service workers: https://bit.ly/CRA-PWA
17 | serviceWorker.unregister();
18 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/integration/hooks-react/boilerplate/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom/extend-expect';
6 |
--------------------------------------------------------------------------------
/integration/hooks-react/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/midway-hooks-react",
3 | "version": "1.0.10",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with Vue3
2 |
3 | Midway Serverless hooks + Vue3 一体化开发脚手架
4 |
5 | 
6 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not dead
4 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true,
5 | },
6 | extends: ['plugin:vue/vue3-essential', 'eslint:recommended', '@vue/typescript/recommended'],
7 | parserOptions: {
8 | ecmaVersion: 2020,
9 | },
10 | rules: {
11 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
13 | '@typescript-eslint/no-var-requires': 'off',
14 | },
15 | };
16 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 | /build
5 |
6 |
7 | # local env files
8 | .env.local
9 | .env.*.local
10 | .env_temp
11 |
12 | # Log files
13 | npm-debug.log*
14 | yarn-debug.log*
15 | yarn-error.log*
16 | pnpm-debug.log*
17 | package-lock.json
18 | .faas_debug_tmp/*
19 | .serverless/*
20 | code.zip
21 |
22 | # Editor directories and files
23 | .idea
24 | .vscode
25 | *.suo
26 | *.ntvs*
27 | *.njsproj
28 | *.sln
29 | *.sw?
30 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ['@vue/cli-plugin-babel/preset'],
3 | };
4 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | # f.yml document https://www.yuque.com/midwayjs/faas/serverless_yml
2 |
3 | service: midway-faas-vue3
4 |
5 | provider:
6 | name: aliyun # tencent
7 | runtime: nodejs10
8 |
9 | plugins:
10 | - npm::@midwayjs/faas-cli-plugin-midway-hooks
11 |
12 | ## aggregation deplpy
13 | aggregation:
14 | application:
15 | deployOrigin: false
16 | functionsPattern:
17 | - '*'
18 |
19 | package:
20 | include:
21 | - build
22 | artifact: code.zip
23 |
24 | functionsRule:
25 | rules:
26 | - baseDir: lambda
27 | events:
28 | http:
29 | basePath: /api
30 | - baseDir: render
31 | events:
32 | http:
33 | basePath: /
34 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hooks-vue3/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | Home|
4 | About
5 |
6 |
7 |
8 |
9 |
31 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 | return exports;
11 | };
12 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: ['./config/'],
5 | imports: ['@midwayjs/faas-middleware-static-file'],
6 | })
7 | export class ContainerConfiguration {}
8 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/src/apis/hook/useMethod.ts:
--------------------------------------------------------------------------------
1 | import { useContext } from '@midwayjs/hooks';
2 |
3 | /**
4 | * Get Request HTTP Method (GET/POST)
5 | */
6 | export function useMethod() {
7 | const { method } = useContext();
8 | return method;
9 | }
10 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/src/apis/render/[...index].ts:
--------------------------------------------------------------------------------
1 | import { withController } from '@midwayjs/hooks';
2 |
3 | export default withController(
4 | {
5 | middleware: ['fmw:staticFile'],
6 | },
7 | async () => {
8 | return 'Building... Please refresh this page later.';
9 | }
10 | );
11 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/hooks-vue3/boilerplate/src/assets/logo.png
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/src/main.ts:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue';
2 | import App from './App.vue';
3 | import router from './router';
4 |
5 | createApp(App).use(router).mount('#app');
6 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/src/shims-vue.d.ts:
--------------------------------------------------------------------------------
1 | declare module '*.vue' {
2 | import { defineComponent } from 'vue';
3 | const component: ReturnType;
4 | export default component;
5 | }
6 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/boilerplate/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | outputDir: 'build',
3 | }
4 |
--------------------------------------------------------------------------------
/integration/hooks-vue3/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/midway-hooks-vue3",
3 | "version": "1.0.2",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/integration/navigation/boilerplate/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.log
3 | *.log.*
4 | logs
5 | .vscode
6 | dest
7 | dist
8 | coverage
9 | .idea
10 | package-lock.json
11 | .DS_*
12 | .nyc*
13 | run/
14 | package-lock.json
15 | .nodejs-cache
16 | AUTHORS
17 | .serverless
18 | .faas_debug_tmp
19 | build
20 |
--------------------------------------------------------------------------------
/integration/navigation/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/navigation/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/navigation/boilerplate/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/navigation/boilerplate/public/logo192.png
--------------------------------------------------------------------------------
/integration/navigation/boilerplate/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/navigation/boilerplate/public/logo512.png
--------------------------------------------------------------------------------
/integration/navigation/boilerplate/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/integration/navigation/boilerplate/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/navigation/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 | exports.tbConfig = {
11 | accessKeyId: process.env.MIDWAY_OTS_ACCESSKEY,
12 | secretAccessKey: process.env.MIDWAY_OTS_SECRET,
13 | endpoint: process.env.MIDWAY_OTS_ENDPOINT,
14 | instancename: process.env.MIDWAY_OTS_INSTANCE
15 | };
16 | return exports;
17 | };
--------------------------------------------------------------------------------
/integration/navigation/boilerplate/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/integration/navigation/boilerplate/src/setupProxy.js:
--------------------------------------------------------------------------------
1 | // @ts-ignore: isolated modules error
2 | const { useExpressDevPack } = require('@midwayjs/faas-dev-pack')
3 | const { resolve } = require('path')
4 |
5 | module.exports = function (app) {
6 | app.use(
7 | useExpressDevPack({
8 | functionDir: resolve(__dirname, '../'),
9 | sourceDir: resolve(__dirname, 'apis'),
10 | // 忽略渲染函数
11 | ignoreWildcardFunctions: ['render'],
12 | // 忽略静态文件地址
13 | ignorePattern: (req) => {
14 | return /\.(js|css|map|json|png|jpg|jpeg|gif|svg|eot|woff2|ttf)$/.test(req.url)
15 | },
16 | })
17 | )
18 | }
19 |
--------------------------------------------------------------------------------
/integration/ots/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with ots
2 |
3 | midway faas + ots 一体化开发脚手架
4 |
5 | 
--------------------------------------------------------------------------------
/integration/ots/boilerplate/_.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.log
3 | *.log.*
4 | logs
5 | .vscode
6 | dest
7 | dist
8 | coverage
9 | .idea
10 | package-lock.json
11 | .DS_*
12 | .nyc*
13 | run/
14 | package-lock.json
15 | .nodejs-cache
16 | AUTHORS
17 | .serverless
18 | .faas_debug_tmp
19 |
--------------------------------------------------------------------------------
/integration/ots/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/ots/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/ots/boilerplate/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/ots/boilerplate/public/logo192.png
--------------------------------------------------------------------------------
/integration/ots/boilerplate/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/ots/boilerplate/public/logo512.png
--------------------------------------------------------------------------------
/integration/ots/boilerplate/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/integration/ots/boilerplate/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/ots/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 |
11 | exports.tbConfig = {
12 | accessKeyId: process.env.MIDWAY_OTS_ACCESSKEY,
13 | secretAccessKey: process.env.MIDWAY_OTS_SECRET,
14 | endpoint: process.env.MIDWAY_OTS_ENDPOINT, // e.g. https://todo-test-list.cn-hangzhou.ots.aliyuncs.com
15 | instancename: process.env.MIDWAY_OTS_INSTANCE // e.g. todo-test-list
16 | };
17 | return exports;
18 | };
--------------------------------------------------------------------------------
/integration/ots/boilerplate/src/components/footer.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | function TodoCount({ todosLeft }) {
4 | const count = todosLeft()
5 |
6 | return (
7 |
8 | {count} item left Powered by Midway Serverless
9 |
10 | )
11 | }
12 |
13 | export default function({ todos }) {
14 | const todosLeft = () => {
15 | return todos.filter((todo) => !todo.completed).length
16 | }
17 |
18 | const display =
19 | todos.length > 0 ? (
20 |
23 | ) : null
24 |
25 | return display
26 | }
--------------------------------------------------------------------------------
/integration/ots/boilerplate/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/integration/ots/boilerplate/src/setupProxy.js:
--------------------------------------------------------------------------------
1 | // @ts-ignore: isolated modules error
2 | const { useExpressDevPack } = require('@midwayjs/faas-dev-pack')
3 | const { resolve } = require('path')
4 |
5 | module.exports = function (app) {
6 | app.use(
7 | useExpressDevPack({
8 | functionDir: resolve(__dirname, '../'),
9 | sourceDir: resolve(__dirname, 'apis'),
10 | // 忽略渲染函数
11 | ignoreWildcardFunctions: ['render'],
12 | // 忽略静态文件地址
13 | ignorePattern: (req) => {
14 | return /\.(js|css|map|json|png|jpg|jpeg|gif|svg|eot|woff2|ttf)$/.test(req.url)
15 | },
16 | })
17 | )
18 | }
19 |
--------------------------------------------------------------------------------
/integration/ots/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/faas-with-ots",
3 | "version": "1.0.4",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/integration/piano/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless X Piano
2 |
3 | midway Serverless + media 一体化开发脚手架
4 |
--------------------------------------------------------------------------------
/integration/piano/boilerplate/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | build
3 | .faas_debug_tmp
--------------------------------------------------------------------------------
/integration/piano/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | service: midway-piano
2 |
3 | provider:
4 | name: aliyun
5 | runtime: nodejs10
6 |
7 | functions:
8 | render:
9 | handler: render.handler
10 | events:
11 | - http:
12 | path: /*
13 | getAudio:
14 | handler: getAudio.handler
15 | events:
16 | - http:
17 | path: /api/getAudio
18 |
19 | aggregation:
20 | agg-demo-all:
21 | deployOrigin: false
22 | functionsPattern:
23 | - '*'
24 |
25 | package:
26 | include:
27 | - build
28 | artifact: code.zip
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/logo192.png
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/logo512.png
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/60.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/60.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/61.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/61.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/62.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/62.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/63.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/63.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/64.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/64.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/65.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/65.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/66.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/66.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/67.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/67.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/68.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/68.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/69.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/69.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/70.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/70.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/71.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/71.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/72.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/72.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/73.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/73.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/74.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/74.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/75.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/75.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/76.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/76.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/midi/77.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/midi/77.wav
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/mp3/90 BPM 34.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/mp3/90 BPM 34.mp3
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/mp3/90 BPM 44.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/piano/boilerplate/public/mp3/90 BPM 44.mp3
--------------------------------------------------------------------------------
/integration/piano/boilerplate/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/piano/boilerplate/src/App.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import App from './App';
4 |
5 | test('renders learn react link', () => {
6 | const { getByText } = render();
7 | const linkElement = getByText(/learn react/i);
8 | expect(linkElement).toBeInTheDocument();
9 | });
10 |
--------------------------------------------------------------------------------
/integration/piano/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 | return exports;
11 | };
--------------------------------------------------------------------------------
/integration/piano/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: [
5 | './config/'
6 | ],
7 | imports: [
8 | '@midwayjs/faas-middleware-static-file'
9 | ]
10 | })
11 | export class ContainerConfiguration {}
--------------------------------------------------------------------------------
/integration/piano/boilerplate/src/apis/getAudio.ts:
--------------------------------------------------------------------------------
1 | import { Provide, Func, Inject } from '@midwayjs/decorator'
2 |
3 | @Provide()
4 | export class GetAudioService {
5 |
6 | @Inject()
7 | ctx;
8 |
9 | @Func('getAudio.handler')
10 | async handler() {
11 | let body = this.ctx.request.body;
12 | let url = './mp3/' +body['metre']+ '.mp3';
13 | return {
14 | url: url
15 | };
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/integration/piano/boilerplate/src/apis/render.ts:
--------------------------------------------------------------------------------
1 | import { Provide, Func } from '@midwayjs/decorator'
2 | @Provide()
3 | export class RenderService {
4 |
5 | @Func('render.handler', { middleware: [ 'fmw:staticFile' ]})
6 | async handler() {
7 | return 'Building... Please refresh this page later.';
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/integration/piano/boilerplate/src/common.css:
--------------------------------------------------------------------------------
1 | .common-container {
2 | padding: 24px;
3 | line-height: 24px;
4 | color: #ccc;
5 | }
6 | .common-card {
7 | margin-bottom: 24px;
8 | }
9 | .common-title {
10 | font-size: 15px;
11 | font-weight: bold;
12 | }
13 | a {
14 | color: #fff;
15 | }
--------------------------------------------------------------------------------
/integration/piano/boilerplate/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/integration/piano/boilerplate/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(
8 |
9 |
10 | ,
11 | document.getElementById('root')
12 | );
13 |
14 | // If you want your app to work offline and load faster, you can change
15 | // unregister() to register() below. Note this comes with some pitfalls.
16 | // Learn more about service workers: https://bit.ly/CRA-PWA
17 | serviceWorker.unregister();
18 |
--------------------------------------------------------------------------------
/integration/piano/boilerplate/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/integration/piano/boilerplate/src/setupProxy.js:
--------------------------------------------------------------------------------
1 | // @ts-ignore: isolated modules error
2 | const { useExpressDevPack } = require('@midwayjs/faas-dev-pack')
3 | const { resolve } = require('path')
4 |
5 | module.exports = function (app) {
6 | app.use(
7 | useExpressDevPack({
8 | functionDir: resolve(__dirname, '../'),
9 | sourceDir: resolve(__dirname, 'apis'),
10 | // 忽略渲染函数
11 | ignoreWildcardFunctions: ['render'],
12 | // 忽略静态文件地址
13 | ignorePattern: (req) => {
14 | return /\.(js|css|map|json|png|jpg|jpeg|gif|svg|eot|woff2|ttf)$/.test(req.url)
15 | },
16 | })
17 | )
18 | }
19 |
--------------------------------------------------------------------------------
/integration/piano/boilerplate/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom/extend-expect';
6 |
--------------------------------------------------------------------------------
/integration/piano/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/faas-piano",
3 | "version": "1.0.9",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ['rax']
3 | };
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | *~
4 | *.swp
5 | *.log
6 |
7 | .DS_Store
8 | .idea/
9 | .temp/
10 | .faas_debug_tmp
11 | .serverless
12 |
13 | build/
14 | dist/
15 | lib/
16 | coverage/
17 | node_modules/
18 |
19 | code.zip
20 | template.yml
21 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/README.md:
--------------------------------------------------------------------------------
1 | # rax-materials-midway-faas-ssr
2 |
3 | ## Getting Started
4 |
5 | ### `npm run start`
6 |
7 | Runs the app in development mode.
8 |
9 | Open [http://localhost:3333](http://localhost:3333) to view it in the browser.
10 |
11 | The page will reload if you make edits.
12 |
13 | ### `npm run build`
14 |
15 | Builds the app for production to the `build` folder.
16 |
17 | ### `npm run deploy`
18 |
19 | Deploy the app to aliyun.
20 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/build.json:
--------------------------------------------------------------------------------
1 | {
2 | "inlineStyle": false,
3 | "publicPath": "./",
4 | "plugins": [
5 | [
6 | "build-plugin-rax-app",
7 | {
8 | "targets": [
9 | "web"
10 | ]
11 | }
12 | ],
13 | "build-plugin-rax-ssr",
14 | "build-plugin-midway-faas"
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | service:
2 | name: midway-rax-ssr-demo
3 | provider:
4 | name: aliyun
5 | functions:
6 | index:
7 | handler: index.handler
8 | events:
9 | - http:
10 | path: /api/index
11 | home:
12 | handler: home.handler
13 | events:
14 | - http:
15 | path: /
16 | assets:
17 | handler: assets.handler
18 | events:
19 | - http:
20 | path: /*
21 | aggregation:
22 | all:
23 | functionsPattern:
24 | - '*'
25 | package:
26 | include:
27 | - build
28 | artifact: code.zip
29 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/web',
8 | dir: join(appInfo.baseDir, '../build/web'),
9 | };
10 |
11 | exports.ssrConfig = {
12 | dir: join(appInfo.baseDir, '../build/node'),
13 | };
14 |
15 | return exports;
16 | };
17 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: [
5 | './config/'
6 | ],
7 | imports: [
8 | '@midwayjs/faas-middleware-static-file'
9 | ]
10 | })
11 | export class ContainerConfiguration {}
12 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/src/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "routes": [
3 | {
4 | "path": "/",
5 | "source": "pages/Home/index"
6 | }
7 | ],
8 | "hydrate": true,
9 | "window": {
10 | "title": "Rax App"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/src/app.ts:
--------------------------------------------------------------------------------
1 | import { runApp } from 'rax-app';
2 | import appConfig from './app.json';
3 |
4 | runApp(appConfig);
5 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/src/components/Logo/index.css:
--------------------------------------------------------------------------------
1 | .logo {
2 | width: 200rpx;
3 | height: 180rpx;
4 | margin-bottom: 20rpx;
5 | }
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/src/components/Logo/index.tsx:
--------------------------------------------------------------------------------
1 | import { createElement } from 'rax';
2 | import Image from 'rax-image';
3 |
4 | import './index.css';
5 |
6 | interface LogoProps {
7 | uri: string;
8 | }
9 |
10 | export default (props: LogoProps) => {
11 | const { uri } = props;
12 | const source = { uri };
13 | return (
14 |
18 | );
19 | };
20 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/src/document/index.jsx:
--------------------------------------------------------------------------------
1 | import { createElement } from 'rax';
2 | import { Root, Style, Script } from 'rax-document';
3 |
4 | function Document() {
5 | return (
6 |
7 |
8 |
9 |
10 | rax-materials-basic-app
11 |
12 |
13 |
14 | {/* root container */}
15 |
16 |
17 |
18 |
19 | );
20 | }
21 | export default Document;
22 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/src/pages/Home/index.css:
--------------------------------------------------------------------------------
1 | .home {
2 | align-items: center;
3 | margin-top: 200rpx;
4 | }
5 |
6 | .title {
7 | font-size: 45rpx;
8 | font-weight: bold;
9 | margin: 20rpx 0;
10 | }
11 |
12 | .info {
13 | font-size: 36rpx;
14 | margin: 8rpx 0;
15 | color: #555;
16 | }
17 |
--------------------------------------------------------------------------------
/integration/rax-ssr/boilerplate/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "esNext",
4 | "experimentalDecorators": true,
5 | "emitDecoratorMetadata": true,
6 | "target": "es2015",
7 | "outDir": "build",
8 | "jsx": "preserve",
9 | "jsxFactory": "createElement",
10 | "moduleResolution": "node",
11 | "sourceMap": true,
12 | "alwaysStrict": true,
13 | "baseUrl": ".",
14 | "skipLibCheck": true,
15 | "resolveJsonModule": true,
16 | "allowSyntheticDefaultImports": true
17 | },
18 | "include": [
19 | "./src/**/*", "src/apis/configuration.ts"
20 | ],
21 | "exclude": [
22 | "build",
23 | "node_modules"
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ['rax']
3 | };
--------------------------------------------------------------------------------
/integration/rax/boilerplate/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | *~
4 | *.swp
5 | *.log
6 |
7 | .DS_Store
8 | .idea/
9 | .temp/
10 | .faas_debug_tmp
11 | .serverless
12 |
13 | build/
14 | dist/
15 | lib/
16 | coverage/
17 | node_modules/
18 |
19 | code.zip
20 | template.yml
21 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/README.md:
--------------------------------------------------------------------------------
1 | # rax-materials-midway-faas-app
2 |
3 | ## Getting Started
4 |
5 | ### `npm run start`
6 |
7 | Runs the app in development mode.
8 |
9 | Open [http://localhost:3333](http://localhost:3333) to view it in the browser.
10 |
11 | The page will reload if you make edits.
12 |
13 | ### `npm run build`
14 |
15 | Builds the app for production to the `build` folder.
16 |
17 | ### `npm run deploy`
18 |
19 | Deploy the faas api to aliyun.
20 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/build.json:
--------------------------------------------------------------------------------
1 | {
2 | "inlineStyle": false,
3 | "plugins": [
4 | [
5 | "build-plugin-rax-app",
6 | {
7 | "targets": [
8 | "web"
9 | ]
10 | }
11 | ],
12 | "build-plugin-midway-faas"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | service:
2 | name: midway-rax-demo
3 | provider:
4 | name: aliyun
5 | functions:
6 | index:
7 | handler: index.handler
8 | events:
9 | - http:
10 | path: /api/index
11 | assets:
12 | handler: assets.handler
13 | events:
14 | - http:
15 | path: /*
16 | aggregation:
17 | all:
18 | functionsPattern:
19 | - '*'
20 | package:
21 | include:
22 | - build
23 | artifact: code.zip
24 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build/web'),
9 | };
10 | return exports;
11 | };
12 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: [
5 | './config/'
6 | ],
7 | imports: [
8 | '@midwayjs/faas-middleware-static-file'
9 | ]
10 | })
11 | export class ContainerConfiguration {}
12 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/src/apis/index.ts:
--------------------------------------------------------------------------------
1 | import { Provide, Func, Inject } from '@midwayjs/decorator';
2 | import { FunctionHandler, FaaSContext, } from '@midwayjs/faas';
3 |
4 | @Provide()
5 | export class IndexHandler implements FunctionHandler {
6 |
7 | @Inject()
8 | ctx: FaaSContext;
9 |
10 | @Inject()
11 | baseDir;
12 |
13 | @Func('assets.handler', { middleware: [ 'fmw:staticFile' ]})
14 | async render() {
15 | return `Cannot GET ${this.ctx.request.path}`;
16 | }
17 |
18 | @Func('index.handler')
19 | async handler(event: any): Promise {
20 | return {
21 | stars: 10000
22 | };
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/src/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "routes": [
3 | {
4 | "path": "/",
5 | "source": "pages/Home/index"
6 | }
7 | ],
8 | "window": {
9 | "title": "Rax App"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/src/app.ts:
--------------------------------------------------------------------------------
1 | import { runApp } from 'rax-app';
2 | import appConfig from './app.json';
3 |
4 | runApp(appConfig);
5 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/src/components/Logo/index.css:
--------------------------------------------------------------------------------
1 | .logo {
2 | width: 200rpx;
3 | height: 180rpx;
4 | margin-bottom: 20rpx;
5 | }
--------------------------------------------------------------------------------
/integration/rax/boilerplate/src/components/Logo/index.tsx:
--------------------------------------------------------------------------------
1 | import { createElement } from 'rax';
2 | import Image from 'rax-image';
3 |
4 | import './index.css';
5 |
6 | interface LogoProps {
7 | uri: string;
8 | }
9 |
10 | export default (props: LogoProps) => {
11 | const { uri } = props;
12 | const source = { uri };
13 | return (
14 |
18 | );
19 | };
20 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/src/document/index.jsx:
--------------------------------------------------------------------------------
1 | import { createElement } from 'rax';
2 | import { Root, Style, Script } from 'rax-document';
3 |
4 | function Document() {
5 | return (
6 |
7 |
8 |
9 |
10 | rax-materials-basic-app
11 |
12 |
13 |
14 | {/* root container */}
15 |
16 |
17 |
18 |
19 | );
20 | }
21 | export default Document;
22 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/src/pages/Home/index.css:
--------------------------------------------------------------------------------
1 | .home {
2 | align-items: center;
3 | margin-top: 200rpx;
4 | }
5 |
6 | .title {
7 | font-size: 45rpx;
8 | font-weight: bold;
9 | margin: 20rpx 0;
10 | }
11 |
12 | .info {
13 | font-size: 36rpx;
14 | margin: 8rpx 0;
15 | color: #555;
16 | }
17 |
--------------------------------------------------------------------------------
/integration/rax/boilerplate/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "esNext",
4 | "experimentalDecorators": true,
5 | "emitDecoratorMetadata": true,
6 | "target": "es2015",
7 | "outDir": "build",
8 | "jsx": "preserve",
9 | "jsxFactory": "createElement",
10 | "moduleResolution": "node",
11 | "sourceMap": true,
12 | "alwaysStrict": true,
13 | "baseUrl": ".",
14 | "skipLibCheck": true,
15 | "resolveJsonModule": true,
16 | "allowSyntheticDefaultImports": true
17 | },
18 | "include": [
19 | "./src/**/*", "src/apis/configuration.ts"
20 | ],
21 | "exclude": [
22 | "build",
23 | "node_modules"
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/integration/rds-mysql/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with mysql
2 |
3 | midway faas + mysql 一体化开发脚手架
4 |
5 | 
--------------------------------------------------------------------------------
/integration/rds-mysql/boilerplate/_.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.log
3 | *.log.*
4 | logs
5 | .vscode
6 | dest
7 | dist
8 | coverage
9 | .idea
10 | package-lock.json
11 | .DS_*
12 | .nyc*
13 | run/
14 | package-lock.json
15 | .nodejs-cache
16 | AUTHORS
17 | .serverless
18 | .faas_debug_tmp
19 |
--------------------------------------------------------------------------------
/integration/rds-mysql/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/rds-mysql/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/rds-mysql/boilerplate/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/rds-mysql/boilerplate/public/logo192.png
--------------------------------------------------------------------------------
/integration/rds-mysql/boilerplate/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/rds-mysql/boilerplate/public/logo512.png
--------------------------------------------------------------------------------
/integration/rds-mysql/boilerplate/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/integration/rds-mysql/boilerplate/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/rds-mysql/boilerplate/scripts/local.js:
--------------------------------------------------------------------------------
1 | const hostName = process.env.HOSTNAME;
2 | if (hostName) {
3 | console.log('');
4 | console.log(`Please open http://${hostName.split('-').slice(0,-2).join('-')}-3000.xide.aliyun.com/index.html`);
5 | console.log('');
6 | console.log('');
7 | }
8 |
--------------------------------------------------------------------------------
/integration/rds-mysql/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 |
11 | exports.dbConfig = {
12 | host: process.env.MIDWAY_RDS_HOST,
13 | port: process.env.MIDWAY_RDS_PORT || 3306,
14 | database: process.env.MIDWAY_RDS_DBNAME,
15 | username: process.env.MIDWAY_RDS_USERNAME,
16 | password: process.env.MIDWAY_RDS_PASSWORD
17 | };
18 | return exports;
19 | };
--------------------------------------------------------------------------------
/integration/rds-mysql/boilerplate/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/integration/rds-mysql/boilerplate/src/setupProxy.js:
--------------------------------------------------------------------------------
1 | // @ts-ignore: isolated modules error
2 | const { useExpressDevPack } = require('@midwayjs/faas-dev-pack')
3 | const { resolve } = require('path')
4 |
5 | module.exports = function (app) {
6 | app.use(
7 | useExpressDevPack({
8 | functionDir: resolve(__dirname, '../'),
9 | sourceDir: resolve(__dirname, 'apis'),
10 | // 忽略渲染函数
11 | ignoreWildcardFunctions: ['render'],
12 | // 忽略静态文件地址
13 | ignorePattern: (req) => {
14 | return /\.(js|css|map|json|png|jpg|jpeg|gif|svg|eot|woff2|ttf)$/.test(req.url)
15 | },
16 | })
17 | )
18 | }
19 |
--------------------------------------------------------------------------------
/integration/rds-mysql/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/faas-with-rds",
3 | "version": "1.0.3",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/integration/react-covid19/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with react-covid19
2 |
3 | midway faas + react + covid19 data
4 |
5 | 
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/_.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /.pnp
5 | .pnp.js
6 | node_modules
7 | .serverless
8 | code.zip
9 |
10 | # testing
11 | /coverage
12 |
13 | # production
14 | /build
15 |
16 | # misc
17 | .DS_Store
18 | .env.local
19 | .env.development.local
20 | .env.test.local
21 | .env.production.local
22 |
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # editor
28 | .idea
29 |
30 | # faas
31 | .faas_debug_tmp
32 |
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | service: midway-faas-covid19-demo
2 |
3 | provider:
4 | name: aliyun
5 | runtime: nodejs10
6 |
7 | functions:
8 | render:
9 | handler: render.handler
10 | events:
11 | - http:
12 | path: /*
13 | index:
14 | handler: index.handler
15 | events:
16 | - http:
17 | path: /api/index
18 |
19 | package:
20 | include:
21 | - build
22 | artifact: code.zip
23 |
24 | aggregation:
25 | agg-demo-all:
26 | deployOrigin: false
27 | functionsPattern:
28 | - '*'
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/react-covid19/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/react-covid19/boilerplate/public/logo192.png
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/react-covid19/boilerplate/public/logo512.png
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './app.css';
3 | import Word from './Word';
4 | export default () => {
5 | return
6 |
7 |
;
8 | }
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 | return exports;
11 | };
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: [
5 | './config/'
6 | ],
7 | imports: [
8 | '@midwayjs/faas-middleware-static-file'
9 | ]
10 | })
11 | export class ContainerConfiguration {}
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/src/apis/index.ts:
--------------------------------------------------------------------------------
1 | import { Provide, Func } from '@midwayjs/decorator'
2 | import Axios from 'axios';
3 |
4 | let cacheResult: any;
5 |
6 | @Provide()
7 | export class IndexService {
8 |
9 | @Func('index.handler')
10 | async handler() {
11 | if (!cacheResult) {
12 | cacheResult = await Axios({
13 | url: 'https://lab.isaaclin.cn/nCoV/api/area'
14 | }).then(response => {
15 | return response.data;
16 | });
17 | }
18 | return cacheResult;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/src/apis/render.ts:
--------------------------------------------------------------------------------
1 | import { Provide, Func } from '@midwayjs/decorator'
2 | @Provide()
3 | export class RenderService {
4 |
5 | @Func('render.handler', { middleware: [ 'fmw:staticFile' ]})
6 | async handler() {
7 | return 'Building... Please refresh this page later.';
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/src/app.css:
--------------------------------------------------------------------------------
1 | .layout {
2 | text-align: center;
3 | background-color: #282c34;
4 | min-height: 100vh;
5 | }
6 |
7 | .layout-header {
8 | display: flex;
9 | padding: 12px 0;
10 | flex-direction: row;
11 | align-items: center;
12 | justify-content: center;
13 | font-size: calc(10px + 2vmin);
14 | color: white;
15 | }
16 |
17 | .layout-header-btn {
18 | margin: 0 12px;
19 | opacity: 0.3;
20 | cursor: pointer;
21 | }
22 | .layout-header-btn-current {
23 | opacity: 1;
24 | }
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(
8 |
9 |
10 | ,
11 | document.getElementById('root')
12 | );
13 |
14 | // If you want your app to work offline and load faster, you can change
15 | // unregister() to register() below. Note this comes with some pitfalls.
16 | // Learn more about service workers: https://bit.ly/CRA-PWA
17 | serviceWorker.unregister();
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/integration/react-covid19/boilerplate/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom/extend-expect';
6 |
--------------------------------------------------------------------------------
/integration/react-covid19/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/faas-with-covid19",
3 | "version": "1.0.4",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/integration/react/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with react
2 |
3 | midway serverless + react 一体化开发脚手架
4 |
5 | 
--------------------------------------------------------------------------------
/integration/react/boilerplate/_.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw?
22 | package-lock.json
23 | .faas_debug_tmp
24 | .serverless
25 | .env_tmp
26 | build
--------------------------------------------------------------------------------
/integration/react/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/react/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/react/boilerplate/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/react/boilerplate/public/logo192.png
--------------------------------------------------------------------------------
/integration/react/boilerplate/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/react/boilerplate/public/logo512.png
--------------------------------------------------------------------------------
/integration/react/boilerplate/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/integration/react/boilerplate/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/App.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import App from './App';
4 |
5 | test('renders learn react link', () => {
6 | const { getByText } = render();
7 | const linkElement = getByText(/learn react/i);
8 | expect(linkElement).toBeInTheDocument();
9 | });
10 |
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/App.tsx:
--------------------------------------------------------------------------------
1 | import Layout from './Layout';
2 |
3 | export default Layout;
4 |
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/Detail.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react';
2 | import './common.css';
3 | export default () => {
4 | const [message, setMessage] = useState('')
5 |
6 | useEffect(() => {
7 | fetch('./api/detail')
8 | .then(resp => resp.json())
9 | .then(({message}) => setMessage(message))
10 | }, [])
11 |
12 |
13 | return (
14 |
15 | { message || 'Loading...' }
16 |
17 | );
18 | }
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 | return exports;
11 | };
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: [
5 | './config/'
6 | ],
7 | imports: [
8 | '@midwayjs/faas-middleware-static-file'
9 | ]
10 | })
11 | export class ContainerConfiguration {}
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/common.css:
--------------------------------------------------------------------------------
1 | .common-container {
2 | padding: 24px;
3 | line-height: 24px;
4 | color: #ccc;
5 | }
6 | .common-card {
7 | margin-bottom: 24px;
8 | }
9 | .common-title {
10 | font-size: 15px;
11 | font-weight: bold;
12 | }
13 | a {
14 | color: #fff;
15 | }
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(
8 |
9 |
10 | ,
11 | document.getElementById('root')
12 | );
13 |
14 | // If you want your app to work offline and load faster, you can change
15 | // unregister() to register() below. Note this comes with some pitfalls.
16 | // Learn more about service workers: https://bit.ly/CRA-PWA
17 | serviceWorker.unregister();
18 |
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/layout.css:
--------------------------------------------------------------------------------
1 | .layout {
2 | text-align: center;
3 | background-color: #282c34;
4 | min-height: 100vh;
5 | }
6 |
7 | .layout-header {
8 | display: flex;
9 | padding: 12px 0;
10 | flex-direction: row;
11 | align-items: center;
12 | justify-content: center;
13 | font-size: calc(10px + 2vmin);
14 | color: white;
15 | }
16 |
17 | .layout-header-btn {
18 | margin: 0 12px;
19 | opacity: 0.3;
20 | cursor: pointer;
21 | }
22 | .layout-header-btn-current {
23 | opacity: 1;
24 | }
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/setupProxy.js:
--------------------------------------------------------------------------------
1 | // @ts-ignore: isolated modules error
2 | const { useExpressDevPack } = require('@midwayjs/faas-dev-pack');
3 | const { resolve } = require('path');
4 | const URL = require('url');
5 |
6 | module.exports = function (app) {
7 | app.use(
8 | useExpressDevPack({
9 | functionDir: resolve(__dirname, '../'),
10 | sourceDir: resolve(__dirname, 'apis'),
11 | // 忽略渲染函数
12 | ignoreWildcardFunctions: ['render'],
13 | // 忽略静态文件地址
14 | ignorePattern: (req) => {
15 | const { pathname } = URL.parse(req.url);
16 | return /\.(js|css|map|json|png|jpg|jpeg|gif|svg|eot|woff2|ttf)$/.test(pathname);
17 | },
18 | })
19 | )
20 | }
21 |
--------------------------------------------------------------------------------
/integration/react/boilerplate/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom/extend-expect';
6 |
--------------------------------------------------------------------------------
/integration/react/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/faas-with-react",
3 | "version": "1.0.9",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/integration/vue2/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with vue
2 |
3 | midway faas + vue 一体化开发脚手架
4 |
5 | 
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/_.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw?
22 | package-lock.json
23 | .faas_debug_tmp
24 | .serverless
25 | .env_tmp
26 | build
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ["@vue/cli-plugin-babel/preset"]
3 | };
4 |
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/vue2/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 | return exports;
11 | };
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: [
5 | './config/'
6 | ],
7 | imports: [
8 | '@midwayjs/faas-middleware-static-file'
9 | ]
10 | })
11 | export class ContainerConfiguration {}
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/vue2/boilerplate/src/assets/logo.png
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/src/main.ts:
--------------------------------------------------------------------------------
1 | import Vue from "vue";
2 | import App from "./App.vue";
3 |
4 | Vue.config.productionTip = false;
5 |
6 | new Vue({
7 | render: h => h(App)
8 | }).$mount("#app");
9 |
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/src/shims-tsx.d.ts:
--------------------------------------------------------------------------------
1 | import Vue, { VNode } from "vue";
2 |
3 | declare global {
4 | namespace JSX {
5 | // tslint:disable no-empty-interface
6 | interface Element extends VNode {}
7 | // tslint:disable no-empty-interface
8 | interface ElementClass extends Vue {}
9 | interface IntrinsicElements {
10 | [elem: string]: any;
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/src/shims-vue.d.ts:
--------------------------------------------------------------------------------
1 | declare module "*.vue" {
2 | import Vue from "vue";
3 | export default Vue;
4 | }
5 |
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/serverless-invoke';
2 | import { HTTPTrigger } from '@midwayjs/serverless-fc-trigger';
3 | import assert from 'assert';
4 | describe('/test/index.test.ts', () => {
5 | it('should use default event', async () => {
6 | const result = await invoke({
7 | functionName: 'index',
8 | data: [
9 | new HTTPTrigger({
10 | path: '/help',
11 | method: 'GET',
12 | })
13 | ],
14 | });
15 | // API Gateway must be get a string text
16 | assert(result.body === '{"message":"Hello Midway!"}');
17 | });
18 | });
--------------------------------------------------------------------------------
/integration/vue2/boilerplate/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | outputDir: "build",
3 | pluginOptions: {
4 | faas: {
5 | // ...
6 | }
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/integration/vue2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/faas-with-vue",
3 | "version": "1.0.11",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/integration/vue3/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with vue3
2 |
3 | Midway Serverless + vue3 一体化开发脚手架
4 |
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/README.md:
--------------------------------------------------------------------------------
1 | # hello-world
2 |
3 | ## Project setup
4 | ```
5 | npm install
6 | ```
7 |
8 | ### Compiles and hot-reloads for development
9 | ```
10 | npm run serve
11 | ```
12 |
13 | ### Compiles and minifies for production
14 | ```
15 | npm run build
16 | ```
17 |
18 | ### Lints and fixes files
19 | ```
20 | npm run lint
21 | ```
22 |
23 | ### Customize configuration
24 | See [Configuration Reference](https://cli.vuejs.org/config/).
25 |
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/_.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 | package-lock.json
10 |
11 | # Log files
12 | npm-debug.log*
13 | yarn-debug.log*
14 | yarn-error.log*
15 | pnpm-debug.log*
16 |
17 | # Editor directories and files
18 | .idea
19 | .vscode
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/vue3/boilerplate/public/favicon.ico
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
7 |
8 |
9 |
10 |
20 |
21 |
31 |
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/src/apis/config/config.default.ts:
--------------------------------------------------------------------------------
1 | import { join } from 'path';
2 |
3 | module.exports = (appInfo: any) => {
4 | const exports = {} as any;
5 |
6 | exports.staticFile = {
7 | prefix: '/',
8 | dir: join(appInfo.baseDir, '../build'),
9 | };
10 | return exports;
11 | };
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/src/apis/configuration.ts:
--------------------------------------------------------------------------------
1 | import { Configuration } from '@midwayjs/decorator';
2 |
3 | @Configuration({
4 | importConfigs: [
5 | './config/'
6 | ],
7 | imports: [
8 | '@midwayjs/faas-middleware-static-file'
9 | ]
10 | })
11 | export class ContainerConfiguration {}
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midwayjs/midway-serverless-examples/57951c788fac9430d5db3462fd77a48d120ea013/integration/vue3/boilerplate/src/assets/logo.png
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/src/main.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import App from './App.vue'
3 |
4 | createApp(App).mount('#app')
5 |
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/serverless-invoke';
2 | import { HTTPTrigger } from '@midwayjs/serverless-fc-trigger';
3 | import assert from 'assert';
4 | describe('/test/index.test.ts', () => {
5 | it('should use default event', async () => {
6 | const result = await invoke({
7 | functionName: 'index',
8 | data: [
9 | new HTTPTrigger({
10 | path: '/help',
11 | method: 'GET',
12 | })
13 | ],
14 | });
15 | // API Gateway must be get a string text
16 | assert(result.body === '{"message":"Hello Midway!"}');
17 | });
18 | });
--------------------------------------------------------------------------------
/integration/vue3/boilerplate/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | outputDir: "build",
3 | pluginOptions: {
4 | faas: {
5 | // ...
6 | }
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/integration/vue3/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/faas-with-vue3",
3 | "version": "1.0.1",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/lerna.json:
--------------------------------------------------------------------------------
1 | {
2 | "packages": [
3 | "aliyun/demo-*",
4 | "tencent/demo-*",
5 | "integration/*",
6 | "framework/*",
7 | "migration/*"
8 | ],
9 | "command": {
10 | "bootstrap": {
11 | "hoist": true,
12 | "noCi": true,
13 | "npmClientArgs": [
14 | "--no-package-lock"
15 | ],
16 | "nohoist": [
17 | "egg"
18 | ]
19 | },
20 | "publish": {
21 | "ignoreChanges": [
22 | "*.md"
23 | ]
24 | }
25 | },
26 | "npmClient": "npm",
27 | "version": "independent"
28 | }
29 |
--------------------------------------------------------------------------------
/migration/eggjs/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with eggjs migration
2 |
3 | midway serverless + eggjs 迁移方案
4 |
5 | 本示例是通过 egg-init 生成,加上迁移的 `f.yml` 而成。
--------------------------------------------------------------------------------
/migration/eggjs/boilerplate/README.md:
--------------------------------------------------------------------------------
1 | # my_egg_demo
2 |
3 |
4 |
5 | ## QuickStart
6 |
7 |
8 |
9 | see [egg docs][egg] for more detail.
10 |
11 | ### Development
12 |
13 | ```bash
14 | $ npm i
15 | $ npm run dev
16 | $ open http://localhost:7001/
17 | ```
18 |
19 | ### Deploy
20 |
21 | ```bash
22 | $ npm start
23 | $ npm stop
24 | ```
25 |
26 | ### npm scripts
27 |
28 | - Use `npm run lint` to check code style.
29 | - Use `npm test` to run unit test.
30 | - Use `npm run autod` to auto detect dependencies upgrade, see [autod](https://www.npmjs.com/package/autod) for more detail.
31 |
32 |
33 | [egg]: https://eggjs.org
--------------------------------------------------------------------------------
/migration/eggjs/boilerplate/_.autod.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = {
4 | write: true,
5 | prefix: '^',
6 | plugin: 'autod-egg',
7 | test: [
8 | 'test',
9 | 'benchmark',
10 | ],
11 | dep: [
12 | 'egg',
13 | 'egg-scripts',
14 | ],
15 | devdep: [
16 | 'egg-ci',
17 | 'egg-bin',
18 | 'egg-mock',
19 | 'autod',
20 | 'autod-egg',
21 | 'eslint',
22 | 'eslint-config-egg',
23 | ],
24 | exclude: [
25 | './test/fixtures',
26 | './dist',
27 | ],
28 | };
29 |
30 |
--------------------------------------------------------------------------------
/migration/eggjs/boilerplate/_.eslintignore:
--------------------------------------------------------------------------------
1 | coverage
2 |
--------------------------------------------------------------------------------
/migration/eggjs/boilerplate/_.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "eslint-config-egg"
3 | }
4 |
--------------------------------------------------------------------------------
/migration/eggjs/boilerplate/_.gitignore:
--------------------------------------------------------------------------------
1 | logs/
2 | npm-debug.log
3 | yarn-error.log
4 | node_modules/
5 | package-lock.json
6 | yarn.lock
7 | coverage/
8 | .idea/
9 | run/
10 | .DS_Store
11 | *.sw*
12 | *.un~
13 | typings/
14 | .nyc_output/
15 |
--------------------------------------------------------------------------------
/migration/eggjs/boilerplate/app/controller/home.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const Controller = require('egg').Controller;
4 |
5 | class HomeController extends Controller {
6 | async index() {
7 | const { ctx } = this;
8 | ctx.body = 'hi, xxxx egg';
9 | }
10 | }
11 |
12 | module.exports = HomeController;
13 |
--------------------------------------------------------------------------------
/migration/eggjs/boilerplate/app/router.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /**
4 | * @param {Egg.Application} app - egg application
5 | */
6 | module.exports = app => {
7 | const { router, controller } = app;
8 | router.get('/', controller.home.index);
9 | };
10 |
--------------------------------------------------------------------------------
/migration/eggjs/boilerplate/config/plugin.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /** @type Egg.EggPlugin */
4 | module.exports = {
5 | // had enabled by egg
6 | // static: {
7 | // enable: true,
8 | // }
9 | };
10 |
--------------------------------------------------------------------------------
/migration/eggjs/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | service: my-egg-demo ## application name
2 |
3 | provider:
4 | name: aliyun ## cloud platform name
5 |
6 | deployType: egg ## application deploy type
--------------------------------------------------------------------------------
/migration/eggjs/boilerplate/test/app/controller/home.test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const { app, assert } = require('egg-mock/bootstrap');
4 |
5 | describe('test/app/controller/home.test.js', () => {
6 | it('should assert', () => {
7 | const pkg = require('../../../package.json');
8 | assert(app.config.keys.startsWith(pkg.name));
9 |
10 | // const ctx = app.mockContext({});
11 | // yield ctx.service.xx();
12 | });
13 |
14 | it('should GET /', () => {
15 | return app.httpRequest()
16 | .get('/')
17 | .expect('hi, egg')
18 | .expect(200);
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/migration/eggjs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/eggjs-migrate-serverless",
3 | "version": "1.0.1",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/migration/express/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with express migration
2 |
3 | midway serverless + express 迁移方案
--------------------------------------------------------------------------------
/migration/express/boilerplate/README.md:
--------------------------------------------------------------------------------
1 | # test-eaas
2 |
3 | test-eaas
4 |
5 | ## QuickStart
6 |
7 |
8 |
9 | see [egg docs][egg] for more detail.
10 |
11 | ### Development
12 |
13 | ```bash
14 | $ npm i
15 | $ npm run dev
16 | $ open http://localhost:7001/
17 | ```
18 |
19 | ### Deploy
20 |
21 | ```bash
22 | $ npm start
23 | $ npm stop
24 | ```
25 |
26 | ### npm scripts
27 |
28 | - Use `npm run lint` to check code style.
29 | - Use `npm test` to run unit test.
30 | - Use `npm run autod` to auto detect dependencies upgrade, see [autod](https://www.npmjs.com/package/autod) for more detail.
31 |
32 |
33 | [egg]: https://eggjs.org
--------------------------------------------------------------------------------
/migration/express/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | service: my-express-demo ## application name
2 |
3 | provider:
4 | name: aliyun ## cloud platform name
5 |
6 | deployType: express ## application deploy type
--------------------------------------------------------------------------------
/migration/express/boilerplate/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-express-demo",
3 | "version": "1.0.0",
4 | "private": true,
5 | "dependencies": {
6 | "body-parser": "^1.19.0",
7 | "express": "^4.17.1"
8 | },
9 | "devDependencies": {
10 | },
11 | "engines": {
12 | "node": ">=10.0.0"
13 | },
14 | "scripts": {
15 | "dev": "node app.js"
16 | },
17 | "repository": {
18 | "type": "git",
19 | "url": ""
20 | },
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/migration/express/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/express-migrate-serverless",
3 | "version": "1.0.2",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/migration/koa/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless with koa migration
2 |
3 | midway serverless + koa 迁移方案
--------------------------------------------------------------------------------
/migration/koa/boilerplate/README.md:
--------------------------------------------------------------------------------
1 | # test-eaas
2 |
3 | test-eaas
4 |
5 | ## QuickStart
6 |
7 |
8 |
9 | see [egg docs][egg] for more detail.
10 |
11 | ### Development
12 |
13 | ```bash
14 | $ npm i
15 | $ npm run dev
16 | $ open http://localhost:7001/
17 | ```
18 |
19 | ### Deploy
20 |
21 | ```bash
22 | $ npm start
23 | $ npm stop
24 | ```
25 |
26 | ### npm scripts
27 |
28 | - Use `npm run lint` to check code style.
29 | - Use `npm test` to run unit test.
30 | - Use `npm run autod` to auto detect dependencies upgrade, see [autod](https://www.npmjs.com/package/autod) for more detail.
31 |
32 |
33 | [egg]: https://eggjs.org
--------------------------------------------------------------------------------
/migration/koa/boilerplate/f.yml:
--------------------------------------------------------------------------------
1 | service: my-koa-demo ## application name
2 |
3 | provider:
4 | name: aliyun ## cloud platform name
5 |
6 | deployType: koa ## application deploy type
--------------------------------------------------------------------------------
/migration/koa/boilerplate/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-koa-demo",
3 | "version": "1.0.0",
4 | "private": true,
5 | "dependencies": {
6 | "koa": "^2.13.0",
7 | "koa-bodyparser": "^4.2.1",
8 | "koa-router": "^9.1.0"
9 | },
10 | "devDependencies": {
11 | },
12 | "engines": {
13 | "node": ">=10.0.0"
14 | },
15 | "scripts": {
16 | "dev": "node app.js"
17 | },
18 | "repository": {
19 | "type": "git",
20 | "url": ""
21 | },
22 | "license": "MIT"
23 | }
24 |
--------------------------------------------------------------------------------
/migration/koa/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@midwayjs-examples/koa-migrate-serverless",
3 | "version": "1.0.1",
4 | "dependencies": {
5 | "light-generator": "1"
6 | },
7 | "boilerplateConfig": {
8 | "root": "boilerplate"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "http://github.com/midwayjs/midway-serverless-examples.git"
13 | },
14 | "scripts": {
15 | "test": "../node_modules/.bin/midway-bin test --timeout=120000",
16 | "cov": "../node_modules/.bin/midway-bin cov --timeout=120000"
17 | },
18 | "files": [
19 | "boilerplate"
20 | ],
21 | "license": "MIT"
22 | }
23 |
--------------------------------------------------------------------------------
/tencent/demo-faas-apigw/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless 空触发器示例
2 |
--------------------------------------------------------------------------------
/tencent/demo-faas-apigw/f.yml:
--------------------------------------------------------------------------------
1 | service:
2 | name: midway-faas-examples
3 |
4 | provider:
5 | name: tencent
6 |
7 | functions:
8 | apiGatewayTrigger:
9 | handler: index.handler
10 | events:
11 | - apigw:
12 | method: get
13 | path: /api
14 |
--------------------------------------------------------------------------------
/tencent/demo-faas-apigw/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@tencent/demo-faas-apigw",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Tencent",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "midway"
11 | ],
12 | "dependencies": {
13 | "@midwayjs/faas": "^1.0.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/tencent/demo-faas-apigw/src/index.ts:
--------------------------------------------------------------------------------
1 | import { Func, Inject, Provide } from '@midwayjs/decorator';
2 | import { FaaSContext, FunctionHandler} from '@midwayjs/faas';
3 |
4 | @Provide()
5 | @Func('index.handler')
6 | export class IndexService implements FunctionHandler {
7 |
8 | @Inject()
9 | ctx: FaaSContext; // context
10 |
11 | async handler() {
12 | this.ctx.set('x-midway-faas-type', '444444')
13 | return {
14 | headers: this.ctx.headers,
15 | method: this.ctx.method,
16 | path: this.ctx.path,
17 | body: this.ctx.request.body,
18 | params: this.ctx.params
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/tencent/demo-faas-apigw/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/tencent/demo-faas-mq/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless
2 |
3 | ## 快速开始
4 |
5 | > 国内用户建议使用 `cnpm` 加速npm,`npm install -g cnpm --registry=https://registry.npm.taobao.org`
6 |
7 |
8 | ### 第一步:安装 serverless
9 |
10 | ```shell script
11 | npm i -g serverless
12 | ```
13 |
14 | ### 第二步:创建项目
15 |
16 | ```shell script
17 | $ serverless install --url https://github.com/midwayjs/midway-faas-examples/tree/master/demo-faas
18 | ```
19 |
20 | ### 第三步:进入目录
21 |
22 | ```shell script
23 | $ cd demo-faas
24 | ```
25 |
26 | ### 第四步:安装npm依赖
27 |
28 | ```shell script
29 | $ npm i
30 | ```
31 |
32 | ## 如何使用?
33 |
34 | [Midway Serverlesss](https://github.com/midwayjs/midway)
35 |
--------------------------------------------------------------------------------
/tencent/demo-faas-mq/f.yml:
--------------------------------------------------------------------------------
1 | service: midway-faas-examples
2 |
3 | provider:
4 | name: aliyun
5 |
6 | functions:
7 | mqTrigger:
8 | handler: mq.handler
9 | events:
10 | - mq:
11 | topic: test-topic
12 |
13 |
--------------------------------------------------------------------------------
/tencent/demo-faas-mq/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@tencent/demo-faas-event-mq",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Tencent",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "tencent",
11 | "midway"
12 | ],
13 | "dependencies": {
14 | "@midwayjs/faas": "^1.0.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/tencent/demo-faas-mq/src/index.ts:
--------------------------------------------------------------------------------
1 | import { FaaSContext, SCF } from '@midwayjs/faas';
2 | import { Func, Inject, Provide } from '@midwayjs/decorator';
3 |
4 | @Provide()
5 | export class CMQTriggerTest {
6 |
7 | @Inject()
8 | ctx: FaaSContext;
9 |
10 | @Func('mq.handler')
11 | async cronHandler(event: SCF.CMQEvent) {
12 | return 'hello world';
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/tencent/demo-faas-mq/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/serverless-invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 |
5 | describe('/test/invokeAliyun/test/invoke.test.ts', () => {
6 | it('invoke', async () => {
7 | const result: any = await invoke({
8 | functionName: 'mqTrigger',
9 | functionDir: join(__dirname, '../')
10 | });
11 | assert(/hello world/.test(result.body));
12 | });
13 | });
14 |
--------------------------------------------------------------------------------
/tencent/demo-faas-mq/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/tencent/demo-faas-os/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless
2 |
3 | ## 快速开始
4 |
5 | > 国内用户建议使用 `cnpm` 加速npm,`npm install -g cnpm --registry=https://registry.npm.taobao.org`
6 |
7 |
8 | ### 第一步:安装 serverless
9 |
10 | ```shell script
11 | npm i -g serverless
12 | ```
13 |
14 | ### 第二步:创建项目
15 |
16 | ```shell script
17 | $ serverless install --url https://github.com/midwayjs/midway-faas-examples/tree/master/demo-faas
18 | ```
19 |
20 | ### 第三步:进入目录
21 |
22 | ```shell script
23 | $ cd demo-faas
24 | ```
25 |
26 | ### 第四步:安装npm依赖
27 |
28 | ```shell script
29 | $ npm i
30 | ```
31 |
32 | ## 如何使用?
33 |
34 | [Midway Serverlesss](https://github.com/midwayjs/midway)
35 |
--------------------------------------------------------------------------------
/tencent/demo-faas-os/f.yml:
--------------------------------------------------------------------------------
1 | service: midway-faas-examples
2 |
3 | provider:
4 | name: tencent
5 |
6 | functions:
7 | index:
8 | handler: index.handler
9 | events:
10 | - os:
11 | bucket: cli-appid.cos.ap-beijing.myqcloud.com
12 | filter:
13 | prefix: filterdir/
14 | suffix: .jpg
15 | events: cos:ObjectCreated:*
16 | enable: false
--------------------------------------------------------------------------------
/tencent/demo-faas-os/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@tencent/demo-faas-event-os",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Tencent",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "tencent",
11 | "midway"
12 | ],
13 | "dependencies": {
14 | "@midwayjs/faas": "^1.0.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/tencent/demo-faas-os/src/index.ts:
--------------------------------------------------------------------------------
1 | import { FaaSContext, func, inject, provide } from '@midwayjs/faas';
2 |
3 | @provide()
4 | @func('index.handler')
5 | export class HelloService {
6 |
7 | @inject()
8 | ctx: FaaSContext; // context
9 |
10 | async handler(event) {
11 | return 'hello world';
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tencent/demo-faas-os/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/serverless-invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 | const servicePath = join(__dirname, '../');
5 |
6 | describe('/test/invokeAliyun/test/invoke.test.ts', () => {
7 | it('invoke', async () => {
8 | const result: any = await invoke({
9 | functionName: 'index',
10 | functionDir: servicePath
11 | });
12 | assert(/hello world/.test(result.body));
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/tencent/demo-faas-os/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------
/tencent/demo-faas-timer/README.md:
--------------------------------------------------------------------------------
1 | # Midway Serverless
2 |
3 | ## 快速开始
4 |
5 | > 国内用户建议使用 `cnpm` 加速npm,`npm install -g cnpm --registry=https://registry.npm.taobao.org`
6 |
7 |
8 | ### 第一步:安装 serverless
9 |
10 | ```shell script
11 | npm i -g serverless
12 | ```
13 |
14 | ### 第二步:创建项目
15 |
16 | ```shell script
17 | $ serverless install --url https://github.com/midwayjs/midway-faas-examples/tree/master/demo-faas
18 | ```
19 |
20 | ### 第三步:进入目录
21 |
22 | ```shell script
23 | $ cd demo-faas
24 | ```
25 |
26 | ### 第四步:安装npm依赖
27 |
28 | ```shell script
29 | $ npm i
30 | ```
31 |
32 | ## 如何使用?
33 |
34 | [Midway Serverlesss](https://github.com/midwayjs/midway)
35 |
--------------------------------------------------------------------------------
/tencent/demo-faas-timer/f.yml:
--------------------------------------------------------------------------------
1 | service: midway-faas-examples
2 |
3 | provider:
4 | name: tencent
5 |
6 | functions:
7 | cronTimerTrigger:
8 | handler: cron.handler
9 | events:
10 | - timer:
11 | type: cron
12 | value: '*/5 * * * *'
13 | payload: 'test'
--------------------------------------------------------------------------------
/tencent/demo-faas-timer/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@aliyun/demo-faas-event-timer",
3 | "private": true,
4 | "version": "1.0.2",
5 | "description": "Midway Serverless Template for the Serverless Framework and Tencent",
6 | "main": "index.js",
7 | "license": "MIT",
8 | "keywords": [
9 | "serverless",
10 | "tencent",
11 | "midway"
12 | ],
13 | "dependencies": {
14 | "@midwayjs/faas": "^1.0.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/tencent/demo-faas-timer/src/index.ts:
--------------------------------------------------------------------------------
1 | import { FaaSContext, FC } from '@midwayjs/faas';
2 | import { Func, Inject, Provide } from '@midwayjs/decorator';
3 |
4 | @Provide()
5 | export class TimerTriggerTest {
6 |
7 | @Inject()
8 | ctx: FaaSContext; // context
9 |
10 | @Func('cron.handler')
11 | async cronHandler(event: FC.TimerEvent) {
12 | return 'hello world';
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/tencent/demo-faas-timer/test/index.test.ts:
--------------------------------------------------------------------------------
1 | import { invoke } from '@midwayjs/serverless-invoke';
2 | import * as assert from 'assert';
3 | import { join } from 'path';
4 |
5 | describe('/test/invokeAliyun/test/invoke.test.ts', () => {
6 | it('invoke', async () => {
7 | const result: any = await invoke({
8 | functionName: 'everyTimerTrigger',
9 | functionDir: join(__dirname, '../')
10 | });
11 | assert(/hello world/.test(result.body));
12 | });
13 | });
14 |
--------------------------------------------------------------------------------
/tencent/demo-faas-timer/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "target": "ES2018",
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "experimentalDecorators": true,
8 | "emitDecoratorMetadata": true,
9 | "inlineSourceMap": false,
10 | "noImplicitThis": true,
11 | "noUnusedLocals": true,
12 | "stripInternal": true,
13 | "pretty": true,
14 | "declaration": true,
15 | "outDir": "dist"
16 | },
17 | "exclude": ["dist", "node_modules", "test"]
18 | }
19 |
--------------------------------------------------------------------------------