CLI Toolbelt

Adding your own features is as simple as spinning up a new model, view and controller. Gravity comes with a CLI toolbelt that you can use to automatically generate the files needed for this.

gravity create viewName -db -ui

This will create:

  1. a new model template in /model directory

  2. a new controller template in the /controller directory that handles the server request and calls the appropriate model method

  3. a new set of endpoints in /api to route the request to your controller methods

  4. a React view in /client/src/views that makes the API request

If you don't want to create a database table, or a React view (if you're using Gravity Native for example) then you can omit the -db and -ui parameters.

Running Unit Tests

The toolbelt can also execute a series of unit tests to rigorously test your application.