Midway - 一个面向未来的云端一体 Node.js 框架
English | 简体中文
- 🐘 全功能:支持 Web 应用/Serverless/微服务/小程序后端等多种场景
- 🐦 前端集成:全新的应用研发体验,通过 全栈 | 函数式 | 使用 "React Hooks" 开发前后端一体化应用
- 🐴 跨平台:支持部署至 Server 或 Serverless
- 🐶 插件:支持使用 Koa/Express/Egg.js 生态插件
- 🐂 示例: 官方提供多种 Node 场景的示例代码,方便开发者快速上手
Midway 是一个适用于构建 Serverless 服务,传统应用、微服务,小程序后端的 Node.js 框架。
Midway 可以使用 Koa,Express 或 Egg.js 作为基础 Web 框架。它还提供了独立使用的基本解决方案,例如 Socket.io,GRPC,Dubbo.js 和 RabbitMQ 等。
此外,Midway 也适用于前端/全栈开发人员的 Node.js 无服务器框架。构建下一个十年的应用程序。可在 AWS,阿里云,腾讯云和传统 VM /容器上运行。与 React 和 Vue 轻松集成。 🌈
import { Controller, Get, Provide } from 'midway';
@Provide()
@Controller('/')
export class HomeController {
@Get('/')
async index(ctx) {
ctx.body = `Welcome to midwayjs!`;
}
}
后端代码 src/apis/lambda/index.ts
import { useContext } from '@midwayjs/hooks'
export async function getPath() {
// 获取请求 HTTP Context
const ctx = useContext()
return ctx.path
}
前端调用 src/page/index.tsx
import { getPath } from './apis/lambda'
getPath().then((path) => {
// 发送 GET 请求到 /api/getPath
// 返回值: /api/getPath
console.log(path)
})
npm i @midwayjs/cli -g --registry=https://registry.npm.taobao.org
## 创建项目
mw new helloworld
## 进入项目路径
cd helloworld && npm run dev
你也可以在阿里云官网知行实验室,学习 Midway 相关的课程。
请访问 midway-examples.
群里会有热心的朋友,也会有新版本发布推送。钉钉扫码加入答疑群
二群
一群(已满)
请告知我们可以为你做些什么,不过在此之前,请检查一下是否有 已经存在的Bug或者意见。
如果你是一个代码贡献者,请参考代码贡献规范。
我们的代码使用 MIT 协议,请放心使用。