This project is DEPRECATED. Please use https://marklogic-community.github.io/grove/ instead!
This is a Slush generator template that produces a skeleton MarkLogic application with the following components:
To run this generator, you need:
npm install -g npm
)npm install -g gulp
)npm install -g slush
) - only needed if you are generating the initial codenpm install -g bower
)Note: the node
command has been renamed to nodejs
. Some dependencies still point to node
, which is out of our control.
You may need to manually alias those commands, or install the node-legacy
package.
Microsoft Windows users should also read the Additional Microsoft Windows Requirements.
The recommended way to install this generator is:
npm install -g slush-marklogic-node
To grab latest features under development you can use:
npm install -g git://github.com/marklogic/slush-marklogic-node.git
Go to the directory under which your new project should be created (the parent), and run:
slush marklogic-node
Or:
slush marklogic-node <app-name>
This will ask you several questions, with some intelligent defaults. The end result should be a subdirectory with a name matching the app-name, containing all the application code.
On Mac or Linux:
cd <app-name>
npm install
bower install
gulp init-local
./ml local install
./ml local mlcp -options_file import-sample-data.options
On Windows:
cd <app-name>
npm install
bower install
gulp init-local
ml.bat local install
ml.bat local mlcp -options_file import-sample-data.options
Go to the generated application directory:
cd <app-name>
The generator installs NodeJS and JavaScript dependencies automatically, but if shared among colleagues, they likely need to run the following commands manually:
npm install
bower install
The generator also creates a local.json
and a deploy/local.properties
, but
those are usually gitignored. Check if they exist. If they do, check the settings,
most importantly the port settings to make sure they list available ports. If
those files don't exist, then use the following command to create them:
gulp init-local
Note: you can use gulp init-dev
and gulp init-prod
to setup properties for
the dev and prod environments.
Note: the deploy properties allow tweaking the MarkLogic side of the application
in great detail. Look inside deploy/build.properties
or the documentation of
the Roxy deployer to learn more about this.
Note: consider editing the _loginMode
variable in ui/app/login/login.service.js
to change the login mode of the application. The default is set to full
. The
other options are top-right
or modal
.
Run the following Roxy commands to deploy the application to the chosen MarkLogic installation. It will create and configure databases, REST servers, users, and roles for you, and deploy the back-end application code.
./ml local bootstrap
./ml local deploy modules
./ml local deploy content
Or on Windows:
ml.bat local bootstrap
ml.bat local deploy modules
ml.bat local deploy content
To launch the middle-tier, and open a browser tab automatically, you only need to run:
gulp serve-local
Note: this will also watch the ui/
folder for changes, compile them, and reload the
browser fully automatically.
Note: to get more debug logging from Express, run with:
DEBUG=http,mail,express:* gulp serve-local
Note: it is possible to override settings on the command-line:
gulp serve-local --ml-host=<your-host> --ml-http-port=8234 --app-port=9234 --nosync
Note: --nosync
will cause no extra browsersync reload proxy to get launched at 3000,
and no browser tab will be opened automatically. In addition you have --verbose
, and
--ignoreErrors
(for gulp build
). A few more flags are documented at the top of
gulpfile.js
.
The application comes with 3000 JSON documents generated by json-generator.com. They will allow you to explore all the features you get out of the box in a better way. You can load them with (MLCP)[https://docs.marklogic.com/guide/ingestion/content-pump] using Roxy.
Before you hit off, check if Roxy can find MLCP:
./ml local mlcp
Roxy will print the following message if it cannot find MLCP:
ERROR: MLCP not found or mis-configured, please check the mlcp-home setting.
Roxy looks for /usr/local/mlcp/
(or \usr\local\mlcp\
) by default. It can be
convenient to just install MLCP there, or create a symlink from /usr/local/mlcp
to where MLCP is installed. Alternatively, edit your deploy/local.properties
, and
append a mlcp-home=/path/to/your/mlcp/
to the end of it. Repeating above command
should show MLCP usage, not an ERROR.
Once MLCP works correctly, you can run:
./ml local mlcp -options_file import-sample-data.options
Or on Windows:
ml.bat local mlcp -options_file import-sample-data.options
Note: the detail controller, the part that handles showing your data, can not only handle JSON, but also XML, Binary, and Text data out of the box.
At some point you might want to deploy and run this as a service on some (demo) server. For details on that see INSTALL.mdown.
Documentation about the slush generator is provided on the Generator Wiki. It covers amongst others:
Project folder structure, which describes the project directory as produces by the generator.
Explaining the stack, which gives a brief description of the overall architecture.
Core Tools and Components, which allows you to learn more about the various tools and components used by or for the application.
Last but not least, the landing page of the out of the box application provides many more links.