diff --git a/@salix-services/app/.editorconfig b/@salix-services/app/.editorconfig new file mode 100644 index 000000000..3ee22e5d3 --- /dev/null +++ b/@salix-services/app/.editorconfig @@ -0,0 +1,13 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# http://editorconfig.org + +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/@salix-services/app/.eslintignore b/@salix-services/app/.eslintignore new file mode 100644 index 000000000..44f397018 --- /dev/null +++ b/@salix-services/app/.eslintignore @@ -0,0 +1 @@ +/client/ \ No newline at end of file diff --git a/@salix-services/app/.eslintrc b/@salix-services/app/.eslintrc new file mode 100644 index 000000000..a6e52975a --- /dev/null +++ b/@salix-services/app/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "loopback" +} \ No newline at end of file diff --git a/@salix-services/app/.gitignore b/@salix-services/app/.gitignore new file mode 100644 index 000000000..aff1045b4 --- /dev/null +++ b/@salix-services/app/.gitignore @@ -0,0 +1,19 @@ +*.csv +*.dat +*.iml +*.log +*.out +*.pid +*.seed +*.sublime-* +*.swo +*.swp +*.tgz +*.xml +.DS_Store +.idea +.project +.strong-pm +coverage +node_modules +npm-debug.log diff --git a/@salix-services/app/.yo-rc.json b/@salix-services/app/.yo-rc.json new file mode 100644 index 000000000..02f3fc17b --- /dev/null +++ b/@salix-services/app/.yo-rc.json @@ -0,0 +1,3 @@ +{ + "generator-loopback": {} +} \ No newline at end of file diff --git a/@salix-services/app/client/README.md b/@salix-services/app/client/README.md new file mode 100644 index 000000000..dd00c9e9c --- /dev/null +++ b/@salix-services/app/client/README.md @@ -0,0 +1,3 @@ +## Client + +This is the place for your application front-end files. diff --git a/@salix-services/app/package.json b/@salix-services/app/package.json new file mode 100644 index 000000000..f8361d598 --- /dev/null +++ b/@salix-services/app/package.json @@ -0,0 +1,32 @@ +{ + "name": "app", + "version": "1.0.0", + "main": "server/server.js", + "scripts": { + "lint": "eslint .", + "start": "node .", + "posttest": "npm run lint && nsp check" + }, + "dependencies": { + "compression": "^1.0.3", + "cors": "^2.5.2", + "helmet": "^1.3.0", + "loopback-boot": "^2.6.5", + "loopback-component-explorer": "^2.4.0", + "serve-favicon": "^2.0.1", + "strong-error-handler": "^1.0.1", + "loopback-datasource-juggler": "^2.39.0", + "loopback": "^2.22.0" + }, + "devDependencies": { + "eslint": "^2.13.1", + "eslint-config-loopback": "^4.0.0", + "nsp": "^2.1.0" + }, + "repository": { + "type": "", + "url": "" + }, + "license": "UNLICENSED", + "description": "app" +} diff --git a/@salix-services/app/server/boot/root.js b/@salix-services/app/server/boot/root.js new file mode 100644 index 000000000..6adce90ad --- /dev/null +++ b/@salix-services/app/server/boot/root.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function(server) { + // Install a `/` route that returns server status + var router = server.loopback.Router(); + router.get('/', server.loopback.status()); + server.use(router); +}; diff --git a/@salix-services/app/server/component-config.json b/@salix-services/app/server/component-config.json new file mode 100644 index 000000000..f36959a48 --- /dev/null +++ b/@salix-services/app/server/component-config.json @@ -0,0 +1,5 @@ +{ + "loopback-component-explorer": { + "mountPath": "/explorer" + } +} diff --git a/@salix-services/app/server/config.json b/@salix-services/app/server/config.json new file mode 100644 index 000000000..40d45f4d6 --- /dev/null +++ b/@salix-services/app/server/config.json @@ -0,0 +1,23 @@ +{ + "restApiRoot": "/api", + "host": "0.0.0.0", + "port": 3000, + "remoting": { + "context": false, + "rest": { + "normalizeHttpPath": false, + "xml": false + }, + "json": { + "strict": false, + "limit": "100kb" + }, + "urlencoded": { + "extended": true, + "limit": "100kb" + }, + "cors": false, + "handleErrors": false + }, + "legacyExplorer": false +} diff --git a/@salix-services/app/server/datasources.json b/@salix-services/app/server/datasources.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/@salix-services/app/server/datasources.json @@ -0,0 +1 @@ +{} diff --git a/@salix-services/app/server/middleware.development.json b/@salix-services/app/server/middleware.development.json new file mode 100644 index 000000000..071c11a30 --- /dev/null +++ b/@salix-services/app/server/middleware.development.json @@ -0,0 +1,10 @@ +{ + "final:after": { + "strong-error-handler": { + "params": { + "debug": true, + "log": true + } + } + } +} diff --git a/@salix-services/app/server/middleware.json b/@salix-services/app/server/middleware.json new file mode 100644 index 000000000..fbfff8165 --- /dev/null +++ b/@salix-services/app/server/middleware.json @@ -0,0 +1,50 @@ +{ + "initial:before": { + "loopback#favicon": {} + }, + "initial": { + "compression": {}, + "cors": { + "params": { + "origin": true, + "credentials": true, + "maxAge": 86400 + } + }, + "helmet#xssFilter": {}, + "helmet#frameguard": { + "params": [ + "deny" + ] + }, + "helmet#hsts": { + "params": { + "maxAge": 0, + "includeSubdomains": true + } + }, + "helmet#hidePoweredBy": {}, + "helmet#ieNoOpen": {}, + "helmet#noSniff": {}, + "helmet#noCache": { + "enabled": false + } + }, + "session": {}, + "auth": {}, + "parse": {}, + "routes": { + "loopback#rest": { + "paths": [ + "${restApiRoot}" + ] + } + }, + "files": {}, + "final": { + "loopback#urlNotFound": {} + }, + "final:after": { + "strong-error-handler": {} + } +} diff --git a/@salix-services/app/server/model-config.json b/@salix-services/app/server/model-config.json new file mode 100644 index 000000000..56f6800af --- /dev/null +++ b/@salix-services/app/server/model-config.json @@ -0,0 +1,16 @@ +{ + "_meta": { + "sources": [ + "loopback/common/models", + "loopback/server/models", + "../common/models", + "./models" + ], + "mixins": [ + "loopback/common/mixins", + "loopback/server/mixins", + "../common/mixins", + "./mixins" + ] + } +} diff --git a/@salix-services/app/server/server.js b/@salix-services/app/server/server.js new file mode 100644 index 000000000..ef738abce --- /dev/null +++ b/@salix-services/app/server/server.js @@ -0,0 +1,29 @@ +'use strict'; + +var loopback = require('loopback'); +var boot = require('loopback-boot'); + +var app = module.exports = loopback(); + +app.start = function() { + // start the web server + return app.listen(function() { + app.emit('started'); + var baseUrl = app.get('url').replace(/\/$/, ''); + console.log('Web server listening at: %s', baseUrl); + if (app.get('loopback-component-explorer')) { + var explorerPath = app.get('loopback-component-explorer').mountPath; + console.log('Browse your REST API at %s%s', baseUrl, explorerPath); + } + }); +}; + +// Bootstrap the application, configure models, datasources and middleware. +// Sub-apps like REST API are mounted via boot scripts. +boot(app, __dirname, function(err) { + if (err) throw err; + + // start the server if `$ node server.js` + if (require.main === module) + app.start(); +});