Install, create and start.
# Install
$ npm install mastor-cli -g
# Create app
$ mastor new myapp
# Start app
$ cd myapp
$ npm start
We have 3 commands: new
, init
and generate
(alias g
).
Create app with new directory.
$ mastor new myapp
$ mastor new myapp --demo
$ mastor new myapp --no-install
--demo
-- Generate a dead simple project for quick prototype--no-install
-- Disable npm install after files created
Create app in current directory. It's options is the same as mastor new
.
Generate route, model and component.
$ mastor g route product-list
$ mastor g model products
$ mastor g component Editor
$ mastor g component Users/UserModal
$ mastor g component Header --no-css
.
├── src # Source directory
├── assets # Store images, icons, ...
├── components # UI components
├── index.css # CSS for entry file
├── index.html # HTML for entry file
├── index.js # Enry file
├── models # Dva models
├── router.js # Router configuration
├── routes # Route components
├── services # Used for communicate with server
└── utils # Utils
└── request.js # A util wrapped dva/fetch
├── .editorconfig #
├── .eslintrc # Eslint config
├── .gitignore #
├── .roadhogrc # Roadhog config
└── package.json #