diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6331da9..0000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/node_modules -/core/utils/logs -/.idea -*.iml \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 44a6a03..0000000 --- a/README.md +++ /dev/null @@ -1,274 +0,0 @@ -# NodeGrid - -NodeGrid is a simple, light-weight ***backend as a service*** framework for mobile applications. Build you app, we care about your backend. NodeGrid core is built on top of light-weight NodeJS and MongoDB - ----------- - -## Documents - -NodeGrid contains REST API for provide the services. NodeGrid provide following services - -- User Management -- Enable Security -- Store and Query dynamic entities (CRUD operations) -- Create relations between dynamic entities -- Send push notification -- Enable server side events - ------------ -##### **User Management** -Developers now need to worry about their application's backend users. NodeGrid provide service for users operations and developers can keep there dynamic data in user object as they wish - -##### **Enable Security** -In each API requests are authenticated using token authentication. For using the NodeGrid, user need to log-in and get a token from system to access the other REST calls. - -##### **Store and Query dynamic entities** -Authenticated user can create, read, update, delete entities just using simple REST calls - -##### **Create relations between stored entities** -This is one of special feature NodeGrid provide to developers. Developers can create relations between the objects and entities they created dynamically. This also can do from simple REST call. - -##### **Send push notification** -From this feature, NodeGrid facilitate all the backend functionalities for GCM (Google Cloud Messaging) & APNS (Apple Push Notification Service). Developers only need to care about there client application. - -##### **Enable server side events** - - ------------ - -
- -## Installation - -#### **Pre-requisite** - - * Node server - v0.10.0 or higher - (http://nodejs.org/) - * NodeJS dependency installer `npm` - (https://www.npmjs.org/) - * MongoDB server - v2.6 or higher - (http://www.mongodb.org/) - -#### **Running** - -After setup the pre-requisite clone the NodeGrid to your system. - - * Install nodejs dependencies, - - > npm install - - * Run the NodeGrid, - - > node app.js - - * Run the NodeGrid with forever, - - > npm start - - ----------- - -
- -## Portal & Analytics - -NodeGrid provide interfaces for access your backend data & check analytics through your web. - -### Portal - -Access the web portal through following url. - -URL: `http://localhost:3000/portal` -
Request Type: `GET` - -![alt tag](https://raw.githubusercontent.com/wiki/nodegrid/nodegrid/images/portal_login.png) - -![alt tag](https://raw.githubusercontent.com/wiki/nodegrid/nodegrid/images/portal_entities.png) - -![alt tag](https://raw.githubusercontent.com/wiki/nodegrid/nodegrid/images/portal_shell.png) - -![alt tag](https://raw.githubusercontent.com/wiki/nodegrid/nodegrid/images/portal_push.png) - -### Analytics - -Access the web analytics through following url. - -URL: `http://localhost:3000/analytics` -
Request Type: `GET` - -![alt tag](https://raw.githubusercontent.com/wiki/nodegrid/nodegrid/images/analytics.png) - ----------- - -
- -## Samples - -### Application Status - -After you install and start `NodeGrid` you can check the application status - -#### **check status** - -URL: `http://localhost:3000/system/status` -
Request Type: `GET` - -> curl -X GET -H "Content-Type: application/json" http://localhost:3000/system/status - -Sample Response: -``` -{ - "status": "SUCCESS", - "msg": "NodeGrid mBaaS status", - "res": { - "nodegridStatus": "GOOD", - "mongoStatus": "CONNECTED" - } -} -``` - -
- -### Users - -To use NodeGrid you need to create users, Those users can access the REST API. - -#### **Create user** - -URL: `http://localhost:3000/system/user` -
Request Type: `POST` -
Data Object: `{"name":"John Smith", "username":"john", "password":"john123"}` - -> curl -X POST -H "Content-Type: application/json" -d '{"name":"John Smith", "username":"john", "password":"john123"}' http://localhost:3000/system/user - -Sample Response: -``` -{ - "status": "SUCCESS", - "msg": "New system user added successfully", - "res": { - "__v": 0, - "data": { - "lastAccessedTime": "", - "createdTime": 1416892013, - "password": "$2a$10$pUu03u5k260tuIKaJpM1cODK0D2CsTj.GxzFHMBfwrHLRHmCOn5/u", - "username": "john", - "name": "John Smith" - }, - "_id": "54740e6d721de8b8135dfb4e" - } -} -``` - -#### **Get user from** - *userId* - -Replace the `` from your user's id. - -URL: `http://localhost:3000/system/user/` -
Request Type: `GET` - -> curl -X GET -H "Content-Type: application/json" http://localhost:3000/system/user/\ - -Sample Response: -``` -{ - "status": "SUCCESS", - "msg": "Data retrieved successfully", - "data": [ - { - "_id": "54740e6d721de8b8135dfb4e", - "data": { - "name": "John Smith", - "username": "john", - "password": "$2a$10$pUu03u5k260tuIKaJpM1cODK0D2CsTj.GxzFHMBfwrHLRHmCOn5/u", - "createdTime": 1416892013, - "lastAccessedTime": "" - }, - "__v": 0 - } - ] -} -``` - -#### **Get user from** - *username* - -Replace the `` from your user's username. - -URL: `http://localhost:3000/system/user/` -
Request Type: `GET` - -> curl -X GET -H "Content-Type: application/json" http://localhost:3000/system/user/\ - -Sample Response: -``` -{ - "status": "SUCCESS", - "msg": "Data retrieved successfully", - "data": [ - { - "_id": "54740e6d721de8b8135dfb4e", - "data": { - "name": "John Smith", - "username": "john", - "password": "$2a$10$pUu03u5k260tuIKaJpM1cODK0D2CsTj.GxzFHMBfwrHLRHmCOn5/u", - "createdTime": 1416892013, - "lastAccessedTime": "" - }, - "__v": 0 - } - ] -} -``` - -#### **Delete user from** - *userId* - -Replace the `` from your user's id. - -URL: `http://localhost:3000/system/user/` -
Request Type: `DELETE` - -> curl -X DELETE -H "Content-Type: application/json" http://localhost:3000/system/user/\ - -Sample Response: -``` -{ - "status": "SUCCESS", - "msg": "System user removed from the collection successfully." -} -``` - -
- -### Token Authentication - -Created user need to authenticate NodeGrid to access the REST API. This authentication happen from accessToken. For each and every REST call, user need to pass accessToken. - -#### **Generate AccessToken** - -URL: `http://localhost:3000/system/security/generateToken` -
Request Type: `POST` -
Data Object: `{"username":"john", "password":"john123"}` - -> curl -X POST -H "Content-Type: application/json" -d '{"username":"john", "password":"john123"}' http://localhost:3000/system/security/generateToken - -Sample Response: -``` -{ - "status": "SUCCESS", - "msg": "New accessToken saved successfully", - "res": { - "__v": 0, - "data": { - "status": "valid", - "expiringTime": 1416980339, - "createdTime": 1416893939, - "userId": "547415c57cb17d271ce44ae7", - "accessToken": "f02a2e0e569b8fc216b3d1da6035d6581ea1cec4" - }, - "_id": "547415f37cb17d271ce44ae8" - } -} -``` - -
-This [App README](https://github.com/NodeGrid/nodegrid/blob/master/core/README.md) will show how to use NodeGrid as an App diff --git a/analytics/analytics_services.js b/analytics/analytics_services.js deleted file mode 100644 index da1207f..0000000 --- a/analytics/analytics_services.js +++ /dev/null @@ -1,66 +0,0 @@ -var uaparser = require('ua-parser') - - -module.exports.createSystemAnalyticsEndPoints = function (app) { - app.get('/analytics/all', function(req, res){ - res.send(analyticsList); - }); - - app.get('/analytics/:durationInSeconds', function(req, res){ - res.send(getHitsforGivenDuration(req.params.durationInSeconds)); - }); - - app.get('/analytics/filter/:filter', function(req, res){ - res.send(getSortedData(req.params.filter)); - }); -} - -module.exports.save = function (req,res,next) { - - if (req.path.lastIndexOf('/analytics') == 0) { - return; - } - var token = false; - if(req.headers.authorization){ - token = true; - } - var uadata = uaparser.parse(req.headers['user-agent']); - var time = new Date().getTime(); - var item = { - "method":req.method, - "path" :req.path, - "token": token, - "time": time, - "browser":uadata.ua.toString(), - "os":uadata.os.toString(), - "device":uadata.device.family - } - - analyticsList.push(item); -} - -function getHitsforGivenDuration(durationInSeconds){ - var time = new Date().getTime() - (durationInSeconds*1000); - return analyticsList.filter(function(element){ - return element.time >= time; - }); - -} - -function getSortedData(filter){ - var groups = {}; - analyticsList.map(function(element){ - var val = groups[element[filter]]; - var key = element[filter]; - if(typeof val === 'undefined'){ - groups[key] = 1; - } - else{ - groups[key] = val+1; - } - }); - - return groups; -} - -var analyticsList = []; diff --git a/analytics/ui/charts/chart_theme.js b/analytics/charts/chart_theme.js old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/charts/chart_theme.js rename to analytics/charts/chart_theme.js diff --git a/analytics/ui/charts/line_chart.js b/analytics/charts/line_chart.js old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/charts/line_chart.js rename to analytics/charts/line_chart.js diff --git a/analytics/ui/charts/pie_chart_browser.js b/analytics/charts/pie_chart_browser.js old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/charts/pie_chart_browser.js rename to analytics/charts/pie_chart_browser.js diff --git a/analytics/ui/charts/pie_chart_device.js b/analytics/charts/pie_chart_device.js old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/charts/pie_chart_device.js rename to analytics/charts/pie_chart_device.js diff --git a/analytics/ui/charts/pie_chart_method.js b/analytics/charts/pie_chart_method.js old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/charts/pie_chart_method.js rename to analytics/charts/pie_chart_method.js diff --git a/analytics/ui/charts/pie_chart_os.js b/analytics/charts/pie_chart_os.js old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/charts/pie_chart_os.js rename to analytics/charts/pie_chart_os.js diff --git a/analytics/ui/charts/pie_chart_token.js b/analytics/charts/pie_chart_token.js old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/charts/pie_chart_token.js rename to analytics/charts/pie_chart_token.js diff --git a/analytics/ui/css/bootstrap.min.css b/analytics/css/bootstrap.min.css old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/css/bootstrap.min.css rename to analytics/css/bootstrap.min.css diff --git a/analytics/ui/css/custom.css b/analytics/css/custom.css old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/css/custom.css rename to analytics/css/custom.css diff --git a/analytics/ui/css/jumbotron.css b/analytics/css/jumbotron.css old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/css/jumbotron.css rename to analytics/css/jumbotron.css diff --git a/analytics/css/loading.css b/analytics/css/loading.css new file mode 100644 index 0000000..d22105d --- /dev/null +++ b/analytics/css/loading.css @@ -0,0 +1,81 @@ +.pace { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + -o-box-sizing: border-box; + box-sizing: border-box; + + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + + -moz-background-clip: padding; + -webkit-background-clip: padding-box; + background-clip: padding-box; + + -webkit-pointer-events: none; + pointer-events: none; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + + position: fixed; + margin: auto; + top: 12px; + left: 0; + right: 0; + bottom: 0; + width: 300px; + height: 25px; + border: 2px solid #2f2f2f; + background-color: #fff; +} + +.pace .pace-progress { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + -o-box-sizing: border-box; + box-sizing: border-box; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + + -webkit-transition: width 1s ease-in-out 1s linear; + -moz-transition: width 1s ease-in-out 1s linear; + -ms-transition: width 1s ease-in-out 1s linear; + -o-transition: width 1s ease-in-out 1s linear; + transition: width 1s ease-in-out 1s linear; + + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + + max-width: 290px; + position: fixed; + + display: block; + position: absolute; + left: 3px; + top: 2px; + height: 17px; + background: #2f2f2f; + color: #fff; + text-align:center; + font-size:40px; + line-height: 90px; + font-family: 'Raleway', sans-serif; +} + +.pace .pace-progress:after { + content: attr(data-progress-text); + display: inline-block; +} + +.pace.pace-inactive { + display: none; +} \ No newline at end of file diff --git a/analytics/ui/imgs/ng.png b/analytics/imgs/ng.png old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/imgs/ng.png rename to analytics/imgs/ng.png diff --git a/analytics/ui/imgs/plus.png b/analytics/imgs/plus.png old mode 100755 new mode 100644 similarity index 100% rename from analytics/ui/imgs/plus.png rename to analytics/imgs/plus.png diff --git a/analytics/ui/index.html b/analytics/index.html old mode 100755 new mode 100644 similarity index 62% rename from analytics/ui/index.html rename to analytics/index.html index 3f588e2..340a46b --- a/analytics/ui/index.html +++ b/analytics/index.html @@ -6,16 +6,18 @@ + NodeGrid - Analytics - + - - + + + @@ -29,8 +31,8 @@ - - NodeGrid Analytics + + NodeGrid Analytics ( DEMO ) @@ -55,16 +57,12 @@
-
-

ADD NEW

- -
-