• Stars
    star
    7,125
  • Rank 5,469 (Top 0.2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🍔 A Node.js Serverless Framework for front-end/full-stack developers. Build the application for next decade. Works on AWS, Alibaba Cloud, Tencent Cloud and traditional VM/Container. Super easy integrate with React and Vue. 🌈

Midway Logo

Midway - 一个面向未来的云端一体 Node.js 框架

GitHub license GitHub tag Build Status Test Coverage lerna PRs Welcome Gitpod Ready-to-Code Code Style: MidwayJS Leaderboard

English | 简体中文

资源

特性

  • 🐘 全功能:支持 Web 应用/Serverless/FaaS/微服务/小程序后端等多种场景,基于装饰器和依赖注入开发企业级应用
  • 🐦 前端集成:全新的云端一体应用研发体验,零 API 调用,使用 "React Hooks " 风格一体研发
  • 🐴 跨平台:支持部署至普通 Server 或 Serverless/FaaS 环境
  • 🐶 扩展:组件化扩展能力,另外支持使用 Koa/Express/Egg.js 生态插件
  • 🐂 示例: 官方提供多种场景的示例代码,方便开发者快速上手
  • 🛡 TypeScript 全面支持

描述

Midway 是一个适用于构建 Serverless 服务,传统应用、微服务,小程序后端的 Node.js 框架。

Midway 可以使用 Koa,Express 或 Egg.js 作为基础 Web 框架。它还提供了独立使用的基本解决方案,例如 Socket.io,GRPC,Dubbo.js 和 RabbitMQ 等。

此外,Midway 也适用于前端/全栈开发人员的 Node.js 无服务器框架。构建下一个十年的应用程序。可在 AWS,阿里云,腾讯云和传统 VM /容器上运行。与 React 和 Vue 轻松集成。 🌈

Demo

使用装饰器开发 Web 应用

import { Controller, Get, Provide } from '@midwayjs/decorator';

@Provide()
@Controller('/')
export class HomeController {

  @Get('/')
  async home() {
    return `Welcome to midwayjs!`;
  }
}

使用函数开发全栈应用

后端代码 src/apis/lambda/index.ts

import {
  Api,
  Get,
  Query,
  useContext,
} from '@midwayjs/hooks';

export default Api(
  Get(),
  Query<{
    page: string;
    limit: string;
  }>(),
  async () => {
    const ctx = useContext();
    return {
      page: ctx.query.page,
      limit: ctx.query.limit,
    };
  }
);

前端调用 src/page/index.tsx

import getArticles from './api';
const response = await getArticles({
  query: { page: '0', limit: '10' },
});
console.log(response); // { page: '0', limit: '10' }

手动调用

fetch('/api/articles?page=0&limit=10')
  .then((res) => res.json())
  .then((res) => console.log(res)); // { page: '0', limit: '10' }

快速上手

$ npm -v

# 如果是 npm v6
$ npm init midway --type=web my_midway_app

# 如果是 npm v7
$ npm init midway -- --type=web my_midway_app

## 进入项目路径
cd my_midway_app && npm run dev

文档和社区

官方示例

midway-examples

请访问 midway-examples

社区优秀示例展示

1、Cool-Admin - 一个很酷的后台权限管理框架

image

VSC Plugin

答疑

群里会有热心的朋友,也会有新版本发布推送。

贡献

请告知我们可以为你做些什么,不过在此之前,请检查一下是否有 已经存在的Bug或者意见

如果你是一个代码贡献者,请参考代码贡献规范。

谁在使用

image 你也想加 Logo ?可以点击 这里 添加。

License

我们的代码使用 MIT 协议,请放心使用。

FOSSA Status

More Repositories

1

pandora

A Manageable, Measurable and Traceable Node.js Application Manager represented by Alibaba powered by TypeScript
TypeScript
3,084
star
2

hooks

"Zero" Api / Type Safe / Fullstack Kit / Powerful Backend
TypeScript
690
star
3

midway-faas

🔱 A simple and lightweight serverless framework
TypeScript
390
star
4

injection

Injection is a powerful inversion of control container that is widely used in the midway framework and brings good user experience.
TypeScript
164
star
5

midway-examples

show midway examples
JavaScript
147
star
6

subway-station

Node.js 地下铁分享资料汇总
115
star
7

pandora-dashboard

A local GUI Dashboard for Pandora.js
JavaScript
52
star
8

sandbox

Sandbox is a Node.js application monitoring platform, which allows the application to be deployed in its own environment, combined with the data source to generate a comprehensive application report.
TypeScript
50
star
9

midway-serverless-examples

TypeScript
36
star
10

midway-boilerplate

midway 系列脚手架仓库
TypeScript
24
star
11

cli

midway cli, provide local develop, test, and deploy functions through the two commands 'mw' or 'midway-bin'.
TypeScript
20
star
12

light-generator

a light generator for generate a boilerplate
TypeScript
15
star
13

sandbox-docker

一份基于 Docker Compose 的 Sandbox 部署配置
TypeScript
14
star
14

mwts

☂️ TypeScript style guide, formatter, and linter.
TypeScript
10
star
15

module-hook

TypeScript
9
star
16

midway-component

midway components
TypeScript
9
star
17

pgo

PGO(Profile Guided Optimization),是一种根据运行时 Profiling Data 来进行优化的技术。
TypeScript
7
star
18

metrics-common

A basic metrics implementation package for data aggregation computing in different scenarios.
TypeScript
6
star
19

midwayjs.github.io

midwayjs site
JavaScript
5
star
20

luckyeye

TypeScript
4
star
21

mwcc

🏜 MidwayJS Compiler Collection
TypeScript
4
star
22

pandora-reporter-open-falcon

pandora metrics reporter for open-falcon
TypeScript
4
star
23

midway-locate

locate your midway or midway-* project
TypeScript
3
star
24

logger

midway logger
TypeScript
3
star
25

event-bus

TypeScript
3
star
26

perf-bot

JavaScript
3
star
27

bundle-helper

midway bundle helper
TypeScript
3
star
28

lb

Go
3
star
29

pandora-example

Pandora.js examples
JavaScript
2
star
30

midway-upgrade

Upgrade midway to the latest version with 1-click
TypeScript
2
star
31

pandora-hook

Deprecated and move to pandora package
JavaScript
2
star
32

pandora-component-sandbox-log-hub-reporter

Pandora.js Component Sandbox Log Hub Reporter
TypeScript
2
star
33

umi-plugin-faas

JavaScript
2
star
34

dorapan

A mirror client sdk for Pandora.js
JavaScript
1
star
35

debugger

Currency Debug
TypeScript
1
star
36

midway-demo-lib

Some dependencies set for midway demo
1
star
37

jsdom-service-worker

Service worker global environment in Node.js
JavaScript
1
star
38

vue-cli-plugin-faas

Vue CLI Plugin For Midway FaaS
JavaScript
1
star
39

midway-code-mod

midway code operation
TypeScript
1
star
40

midway-next-site

TypeScript
1
star
41

vue-cli-plugin-midway-hooks

Provide midway hooks dev pack options to vue-cli
TypeScript
1
star
42

grpc-helper

TypeScript
1
star
43

glob

TypeScript
1
star
44

egg-ts-helper

JavaScript
1
star
45

mwtsc

it's a tsc wrapper
JavaScript
1
star