Docs:Getting Started
- ☁️ 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
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,
};
} |
Please install @midwayjs/cli
first.
$ npm i @midwayjs/cli -g
mw new my-app
$ npm run dev
$ node bootstrap.js
$ npm run deploy
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- 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
Midway Serverless based MIT licensed.