mvc [--database DB]] [--full] [--keep] [--layout layoutPage]  [--listen
       port[--min[--overwrite[--quiet[--verbose] [commands ...]


       The  mvc command generates, manages and runs Ejscript web applications.
       It can generate Ejscript web applications, controllers, database migra-
       tions, models, scaffolds and views.

       Mvc  will create directories and generate configuration and source code
       files which can then be manually edited as required.  Mvc  is  intelli-
       gent  and will not overwrite existing files, so you can safely edit and
       regenerate without losing your changes. You can overwrite your  changes
       if you wish to by using the --overwrite switch.

       Mvc can run your application by invoking a configured web server.


       To  start  a  new  web  application,  run mvc to create the application
       directory and generate  the  application  configuration  and  essential
       script files. For example:

             mvc generate app myApp

       This  will  will  create  a set of directories which have the following

             bin            - Programs and scripts
             cache          - Cached views and web pages
             controllers    - Controller source
             db             - Databases and scripts
             db/migrations  - Databases migration scripts
             layouts        - Template layout files
             models         - Database model code
             src            - Extra application source code
             views          - View source files
             static         - Public web directory
             static/images  - Public images
             static/js      - Client side JavaScripts
             static/themes  - Application HTML themes

       Ejscript follows conventions where  specific  files  are  stored.  This
       greatly simplifies configuring a web application.

       Mvc will also create some files which have the following meaning:

             ejsrc                       - Application configuration file
             controllers/         - Application base controller class
             layouts/default.ejs         - Default layout web page
             static/layout.css           - Default layout CSS file
             static/themes/default.css   - Default theme CSS file

       action  named index.  Actions are controller functions that are invoked
       in response to client requests. You can edit the controller  source  to
       meet your needs.


       Database models are Ejscript classes that encapsulate database data and
       provide access methods. They provide a conduit  to  interact  with  the
       database. To generate a model:

             mvc generate model MODEL [field:type ...]

       This will create a database model and will generate a model class under
       the models directory.  It will also create a database migration to cre-
       ate a database table of the same name as the model.  If field:type val-
       ues are supplied, the database migration will include code to create  a
       column  for each specified field of the requested type. The valid data-
       base types are: binary, boolean, date, datetime, decimal, float,  inte-
       ger, number, string, text, time, timestamp.


       A  scaffold  is  a  generated  database migration, database model, con-
       troller and set of views that provides add, edit and list functionality
       for  a database model.  Scaffolds are useful to quickly generate chunks
       of the application and prototype web pages and actions for  managing  a
       datbase table.  To generate a scaffold:

             mvc generate scaffold MODEL [field:type ...]

       This  will  create a scaffold for the specified database model and will
       generate a controller of the same name.  If field:type values are  sup-
       plied,  the database migration will include code to create a column for
       each specified field of the requested type. The  valid  database  types
       are:  binary, boolean, date, datetime, decimal, float, integer, number,
       string, text, time, timestamp.   The  scaffold  will  include  an  edit
       action  and view that provides add and edit capability. The list action
       and view, provides the ability to list  the  database  table  rows  and
       select an entry to edit.


       Database  migrations  are  scripts  which modify the database schema or
       content. You can create database migrations by the mvc generate  migra-
       tion  command.  This command generates a migration for a specific model
       by creating or removing tables and columns. To generate a migration:

             mvc generate migration description MODEL [field:type ...]

       This will create a migration script under the db/migrations  directory.
       Migration  scripts filenames are timestamped and use the description is
       used as part of the filename for the migration script (so keep it short
       and sweet).

       migration script file name.


       Ejscript compiles models, views and controllers into Ejscript byte-code
       modules. These are then loaded and  run  by  Ejscript  in  response  to
       incoming  client  requests.  Code  is compiled only once but can be run
       many times to service incoming requests.

       In development mode, Ejscript will automatically compile  the  relevant
       portions  of  the  application  if  the source code is modified. It can
       intelligently recompile views, actions, controllers and database models
       as required. However, you can also explicilty recompile portions or the
       complete appliction.

       Mvc can recompile everything via:

             mvc compile

       This will compile each controller  and  view  and  also  recompile  the
       application  and  module  source  code. Module files for each component
       will be generated.

       Mvc also provides options for you to individually  compile  controllers
       and views. To recompile named views or controllers:

             mvc compile view NAMES ...

             mvc compile controller NAMES ...

       Models are compiled with application code into a single module file. To
       recompile the models and application source code:

             mvc compile app

       To compile the entire application and produce a single module file:

             mvc compile all

       To compile stand-alone Ejscript web pages:

             mvc compile path/name.ejs....

       When compiling views, you can use the --keep  switch  to  preserve  the
       intermediate generated Ejscript source file.


       To run your application:

             mvc run

             mvc compile path/name.ejs ...
             mvc generate [app name | controller name [action [, action] ...]|
            model name]
             mvc generate scaffold model [controller] [action [, action]...]
             mvc run

       --database connector
             Select a database connector to use. Currently this switch is  not
             implemented and sqlite is the only connector supported.

             Preserve  generated  intermediate  Ejscript  source  files. These
             files are generated when blending views with layout pages.

       --layout layoutPage
             Change the name of the default layout page if  a  view  does  not
             explicitly specify a layout page.

             Overwrite  existing files. Mvc normally will not overwrite exist-
             ing files. This is to preserve user changes to previously  gener-
             ated files.

       --search ejsPath
             Set  the  module  search path. The module search path is a set of
             directories that the mvc command will use when locating and load-
             ing Ejscript modules.  The search path will always have some sys-
             tem directories appended to the end. These include  paths  speci-
             fied  via the  EJSPATH environment variable and key system direc-
             tories such as the  Ejscript  system  module  directory  and  the
             directory containing the mvc command.

             The  search  path  value  is similar in format to the system PATH
             variable format.  On windows, path segments are separated by  ";"
             and  on Linux, Unix, FreeBSD and MAC, the path segments are sepa-
             rated by ":" delimiters.

             Given a module named "a.b.c" in a script, mvc will use  the  fol-
             lowing search strategy to locate the module:

             1. Search for a module file named "a.b.c.mod"

             2. Search for a module file named "a/b/c.mod"

             3. Search for a module file named "a.b.c.mod" in the search path

             4. Search for a module file named c.mod in the search path

       --verbose or -v
             Run in verbose mode and trace actions to the console.

mvc                              December 2011                          MVC(1)

Man(1) output converted with man2html