#  <%= props.applicationName %>
## <%= props.applicationTitle %>

##How to install
```
$ git clone --recurse-submodules https://github.com/snaphy-plugin-2/demo.git
$ cd demo
$ git submodule init 
$ git submodule update
$ #Install strongloop as global framework
$ npm install -g strongloop
$ #install imageMagick for image processing..
$ sudo apt-get install imageMagick
$ #Use ./install.js i or npm install to install dependencies
$ ./install i #You can also use "npm install" here
$ #Use slc run command to run server
$ slc run 
```

###Dependencies 
1. NODEJS
2. NPM
3. MONGODB 

####Requirements for MongoDb Database 

######For Testing(Development)
1. You need to install `mongodb` with following credentials. 
    * Database: `drugcorner`
    * Username: `robins`
    * Password: `12345` 
    
2. You can also use your existing database by modifying `server/datasources.json` file  
Example
```
 "mongodb": {
     "host": "127.0.0.1", <== host
     "port": 27017, <== port
     "database": "drugcorner", <== database name
     "password": "12345", <== password
     "name": "mongodb",
     "connector": "mongodb",
     "connectionTimeout": 18000,
     "user": "robins" <==Username
   },
```


3. How to create user account on a freshly installed mongodb server.
  * Login to mongodb shell `$ mongo`
  * Inside mongodb shell
  ```
  $ use admin //switch to admin database assuming you have already an admin database with password
  $ db.auth('adminUsername', 'adminPassword') //Login to admin database.
  //Now switch to drugcorner database. 
  //Create a  user for drugcorner.
  $ use drugcorner 
  $ db.createUser({
       user:"robins",
       pwd:"12345",
       roles:["readWrite"]
    });
  ```
  
  
4. How to login to admin panel at `http://0.0.0.0:3000|3001`  for production or development respectively .
  * Login with username `test`
  * Enter password as `12345`
  
  
5. How to deploy 
0. Install pm2 `sudo npm install pm2 -g`
1. `$ pm2 deploy ecosystem.json production setup`
2. `$ pm2 deploy ecosystem.json production deploy`


6. How to check server status and log
1. login to remove server
2. To check server status `$ pm2 status server`
3. To restart server `pm2 restart server`
3. To start server `pm2 start server`
3. To stop server `pm2 stop server`
3. To check log on the server in realtime `pm2 logs`




7. How to update settings of plugins.
    a. Go to `common/settings`
    b. Each folder will corresponds to a plugin setting with same name of plugin.
    c. Each folder will contain following files.
        1. `admin-panel-settings.js` //Contains all settings required for front-end side of admin panel.
        2. `conf.json` //Contains All the settings user can access from backend using `packageObj.settingName` inside `backend` folder.
        3. `database.json` //Contains all the model necessary for the current plugin. Accessed using `databaseObj.databaseKeyName`.
        4. `static.json`  //Contains all the static files and their assosiation link. You can also add hooks here too.


##How to update email brandzoomr Email
1. Change configuration in these files
    `server/datasources.json`  
   `server/datasources.production.json`  
   `server/datasources.development.json`      
    ```
           {
            "GoogleEmail": {
                "name": "GoogleEmail",
                "defaultForType": "mail",
                "connector": "mail",
                "transports": [
                  {
                    "type": "SMTP",
                    "host": "smtp.zoho.com",
                    "aliases": [
                      "Zoho Mail"
                    ],
                    "secure": true,
                    "port": 465,
                    "auth": {
                      "user": "test@snaphy.com",
                      "pass": "123456789"
                    }
                  }
                ]
              }
          }
    ```
2. Open file `conf.json` in folder `settings/email/` now update the following.   
    ```
        {     
            "from": "'FirstName LastName' <test@snaphy.com>"
        }
    ```

###To clone the Module
```
git clone --recurse-submodules https://github.com/snaphy-plugin-2/demo.git
#After go to project root folder.
git submodule init 
git submodule update
```

This project is generated by [Snaphy](http://snaphy.com).
