Getting started with CleverStack
Prerequisites
cleverstack-cli depends on NPM, GruntJS and Bower.
$npm install bower -g
$npm install grunt-cli -g
*Note: In windows, these commands are best executed in a cygwin terminal interface such as git bash
1. Install NodeJS
2. Do a global install of clever-stack:
$ npm install cleverstack-cli -g
3. Create a new project:
$ clever init YOURAPPNAME
Making the register/login work:
$ clever install clever-auth
Follow the cli prompts and set database information etc. (We used MySQL DB and REDIS)
The installation will automatically install clever-orm module as well
If the installation fails in some try running the install command again
Once the installation completed you should be able to register a user, view the user list, logout and login.
Adding a new Module
1. (for initial setup create a directives and services module as well)
$ clever new YOURMODULENAME
2. In new module’s module.js, change the route to the module name:
$routeProvider
.when(‘/YOURMODULENAME‘, {…
3. Add this new module to the main.js in your module’s folder root:
define([
‘./YOURMODULENAME‘
…
4. Add your new module to modules/application (Inject this module into the following files)
4.1 config.js
4.2 main.js
4.3 modules.js
Repeat steps 1-4 for each new module.
Running your CleverStack application
1. Install JDK 6
$ cd YOURAPPNAME
$ clever server
E2E testing
1. Global install protractor:
$ npm install -g protractor
$ webdriver-manager update
3. Edit the test-e2e.conf.js file
3.1 Comment out
3.1.1 seleniumServerJar [line 18]
3.1.2 seleniumPort [line 21]
3.1.2 chromeDriver [line 28]
3.2 Uncomment
3.2.1 seleniumAddress [line 23]
4. Add your domain code to the tests-e2e.conf.js specs array [line 42]
‘./app/modules/**/domain/test*/e2e/*.js’
5. Frontend changes
in ‘frontend/app/modules/cs_common/cs_http_options_provider.js’
set domain to API path and port [line 60]
in ‘frontend/app/modules/cs_account/scripts/cs_accounts_service.js’
set correct get path (eg. /user/getusers) [line 12]
set correct post path (eg. /user/postuser) [line 18]
6. Run tests by using 2 terminals
Terminal 1:
$ webdriver-manager start
Terminal 2:
$ cd to project folder
$ clever test e2e
Leave a Reply