Need help with hooks?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

midwayjs
529 Stars 33 Forks MIT License 566 Commits 8 Opened issues

Description

FullStack / Zero Api / Using "React Hooks" to develop the back-end / Vite

Services available

!
?

Need anything else?

Contributors list

Midway Logo

Full Stack Framework: Faster & More Productive

中文 README

Docs:Getting Started

✨ Features

  • ☁️  Fullstack, the src directory contains front-end and back-end code
  • 🌈  "Zero" Api, import server functions directly into frontend and automatically create API requests.
  • 🌍  Using "React Hooks | Vue composition Api" to develop the back-end
  • ⚡️  Extremely fast start-up speed, less than 3S
  • ⚙️  Using Vite, supports Vue/React (any other framework supported by Vite)
  • ✈️  Deploy to Server or Serverless
  • 🛡  TypeScript Ready

🌰 Demo

front-end invoke back-end api
import { getPath, post } from './apis/lambda';

// send GET request to /api/getPath
const path = await getPath();
console.assert(path === '/api/getPath');

const { message, method } = await post('Jake');

console.assert(message === 'Hello Jake!');
console.assert(method === 'POST');





import { useContext } from '@midwayjs/hooks';

export async function getPath() {
  // Get HTTP request context by Hooks
  const ctx = useContext();
  return ctx.path;
}

export async function post(name: string) {
  const ctx = useContext();

  return {
    message: `Hello ${name}!`,
    method: ctx.method,
  };
}

🚀 Quick Start

Please install

@midwayjs/cli
first.
$ npm i @midwayjs/cli -g

Create

mw new my-app

Run

$ npm run dev

Deploy to custom server

$ node bootstrap.js

Deploy to Serverless

$ npm run deploy

Contribute

  1. Fork it!
  2. Create your feature branch:
    git checkout -b my-new-feature
  3. Commit your changes:
    git commit -am 'Add some feature'
  4. Push to the branch:
    git push origin my-new-feature
  5. Submit a pull request :D

We use yarn + lerna to manage the project.

  • install dependencies
$ yarn
  • build
$ yarn build
  • watch
$ yarn watch
  • test
$ yarn test

license

Midway Serverless based MIT licensed.

About

Alibaba Open Source

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.