gina 0.0.9-p91c → 0.1.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +46 -0
- package/{core/asset/html/static.html → Icon/r} +0 -0
- package/LICENSE +1 -1
- package/README-4Contributors.md +96 -0
- package/README.md +296 -104
- package/bin/cli +287 -0
- package/bin/cli-debug +60 -0
- package/bin/cmd +184 -0
- package/bin/gina +180 -0
- package/config/logger.json +17 -0
- package/doc/framework/cli/doc.json +9 -0
- package/doc/framework/index.md +60 -0
- package/framework/v0.1.1-alpha.3/AUTHORS +7 -0
- package/{core/utils/lib/inherits → framework/v0.1.1-alpha.3}/LICENSE +1 -1
- package/framework/v0.1.1-alpha.3/VERSION +1 -0
- package/{core/locales/dist/language/en.json → framework/v0.1.1-alpha.3/core/asset/html/nolayout.html} +0 -0
- package/{core/locales/dist/language/fr.json → framework/v0.1.1-alpha.3/core/asset/html/static.html} +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/android-chrome-192x192.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/android-chrome-512x512.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/apple-touch-icon.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/favicon-16x16.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/favicon-32x32.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/favicon.ico +0 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.js +20904 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.js.map +56 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.css +1 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.css.map +1 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.js +736 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.js.map +56 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.onload.min.js +5 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.onload.min.js.map +8 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/readme.md +192 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/uuid.json +23 -0
- package/framework/v0.1.1-alpha.3/core/config.js +2308 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/index.js +757 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/connector.js +20 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/connector.v2.js +429 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/connector.v3.js +432 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/n1ql.js +14 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/session-store.js +21 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/session-store.v2.js +258 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/session-store.v3.js +341 -0
- package/{core → framework/v0.1.1-alpha.3/core}/controller/controller.framework.js +3 -2
- package/framework/v0.1.1-alpha.3/core/controller/controller.js +3990 -0
- package/{core → framework/v0.1.1-alpha.3/core}/controller/index.js +5 -5
- package/framework/v0.1.1-alpha.3/core/deps/busboy/.travis.yml +17 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/LICENSE +19 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/README.md +225 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/deps/encoding/encoding-indexes.js +73 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/deps/encoding/encoding.js +2391 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/main.js +89 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/types/multipart.js +328 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/types/urlencoded.js +214 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/utils.js +191 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/package.json +69 -0
- package/framework/v0.1.1-alpha.3/core/deps/swig-client/swig-2.0.0.min.js +5 -0
- package/{core → framework/v0.1.1-alpha.3/core}/dev/index.js +5 -5
- package/{core → framework/v0.1.1-alpha.3/core}/dev/lib/class.js +1 -1
- package/{core → framework/v0.1.1-alpha.3/core}/dev/lib/factory.js +1 -1
- package/{core → framework/v0.1.1-alpha.3/core}/dev/lib/tools.js +0 -0
- package/framework/v0.1.1-alpha.3/core/gna.js +1070 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/README.md +41 -2
- package/{core → framework/v0.1.1-alpha.3/core}/locales/currency.json +0 -0
- package/{core/plugins/README.md → framework/v0.1.1-alpha.3/core/locales/dist/language/en.json} +0 -0
- package/{core/plugins/lib/intl/README.md → framework/v0.1.1-alpha.3/core/locales/dist/language/fr.json} +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/dist/region/en.json +0 -0
- package/framework/v0.1.1-alpha.3/core/locales/dist/region/fr.json +9492 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/index.js +5 -4
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/make.js +15 -12
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/resources/currency.csv +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/resources/region.csv +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/resources/region.mapping.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/mime.types +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/model/entity.js +156 -196
- package/{core → framework/v0.1.1-alpha.3/core}/model/index.js +67 -48
- package/{core → framework/v0.1.1-alpha.3/core}/model/template/entityFactory.js +2 -2
- package/{core → framework/v0.1.1-alpha.3/core}/model/template/index.js +8 -10
- package/{core/plugins/lib/storage → framework/v0.1.1-alpha.3/core/plugins}/README.md +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/index.js +3 -3
- package/{core/plugins/lib/validator → framework/v0.1.1-alpha.3/core/plugins/lib/file}/README.md +0 -0
- package/{core/plugins/lib/intl → framework/v0.1.1-alpha.3/core/plugins/lib/file}/build.json +0 -0
- package/framework/v0.1.1-alpha.3/core/plugins/lib/file/package.json +25 -0
- package/{core/utils/lib/collection → framework/v0.1.1-alpha.3/core/plugins/lib/intl}/README.md +0 -0
- package/{core/plugins/lib/storage → framework/v0.1.1-alpha.3/core/plugins/lib/intl}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/intl/package.json +3 -3
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/intl/src/main.js +17 -1
- package/{core/utils/lib/routing → framework/v0.1.1-alpha.3/core/plugins/lib/storage}/README.md +0 -0
- package/{core/plugins/lib/validator → framework/v0.1.1-alpha.3/core/plugins/lib/storage}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/storage/package.json +2 -2
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/storage/src/main.js +91 -85
- package/{core/utils/lib/url → framework/v0.1.1-alpha.3/core/plugins/lib/validator}/README.md +0 -0
- package/{core/utils/lib/collection → framework/v0.1.1-alpha.3/core/plugins/lib/validator}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/validator/package.json +3 -3
- package/framework/v0.1.1-alpha.3/core/plugins/lib/validator/src/form-validator.js +1762 -0
- package/framework/v0.1.1-alpha.3/core/plugins/lib/validator/src/main.js +6917 -0
- package/framework/v0.1.1-alpha.3/core/router.js +664 -0
- package/framework/v0.1.1-alpha.3/core/server.express.js +213 -0
- package/framework/v0.1.1-alpha.3/core/server.isaac.js +386 -0
- package/framework/v0.1.1-alpha.3/core/server.js +3010 -0
- package/{core → framework/v0.1.1-alpha.3/core}/status.codes +8 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/app.json +6 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/routing.json +11 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/settings.json +9 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/settings.server.json +30 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/templates.json +42 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/controllers/controller.content.js +39 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/controllers/controller.js +30 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/controllers/setup.js +111 -0
- package/{core/template/samples → framework/v0.1.1-alpha.3/core/template/boilerplate}/bundle/index.js +0 -0
- package/{core/template/samples/bundle → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_namespace}/controllers/controller.js +9 -7
- package/{core/template/views → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public}/css/default.css +0 -0
- package/{core/template/views → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public}/css/vendor/readme.md +0 -0
- package/{core/template/views → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public}/favicon.ico +0 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public/js/vendor/readme.md +1 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public/readme.md +1 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_templates/handlers/main.js +24 -0
- package/{core/template/views/html/default.html → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_templates/html/homepage.html} +0 -0
- package/{core/template/views/html/layout.html → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_templates/html/layout/main.html} +2 -2
- package/{core → framework/v0.1.1-alpha.3/core}/template/command/gina.bat.tpl +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/command/gina.tpl +1 -1
- package/framework/v0.1.1-alpha.3/core/template/conf/env.json +76 -0
- package/{core/template/conf/project.json → framework/v0.1.1-alpha.3/core/template/conf/manifest.json} +1 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/conf/package.json +2 -2
- package/framework/v0.1.1-alpha.3/core/template/conf/settings.json +92 -0
- package/framework/v0.1.1-alpha.3/core/template/conf/statics.json +10 -0
- package/framework/v0.1.1-alpha.3/core/template/conf/templates.json +37 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/client/json/401.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/client/json/403.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/client/json/404.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/server/html/50x.html +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/server/json/500.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/server/json/503.json +0 -0
- package/{core/utils/lib/routing/build.json → framework/v0.1.1-alpha.3/core/template/extensions/logger/config.json} +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/console.js +3 -3
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/context.js +240 -49
- package/framework/v0.1.1-alpha.3/helpers/dateFormat.js +528 -0
- package/framework/v0.1.1-alpha.3/helpers/index.js +79 -0
- package/framework/v0.1.1-alpha.3/helpers/json/README.md +0 -0
- package/framework/v0.1.1-alpha.3/helpers/json/package.json +20 -0
- package/framework/v0.1.1-alpha.3/helpers/json/src/main.js +97 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/path.js +342 -140
- package/framework/v0.1.1-alpha.3/helpers/plugins/README.md +4 -0
- package/framework/v0.1.1-alpha.3/helpers/plugins/package.json +20 -0
- package/framework/v0.1.1-alpha.3/helpers/plugins/src/api-error.js +160 -0
- package/framework/v0.1.1-alpha.3/helpers/plugins/src/main.js +32 -0
- package/framework/v0.1.1-alpha.3/helpers/prototypes.js +218 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/task.js +49 -29
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/text.js +7 -7
- package/framework/v0.1.1-alpha.3/lib/archiver/README.md +0 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/build.json +0 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/src/dep/jszip.min.js +15 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/src/main.js +499 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/aliases.json +13 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/add.js +507 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/arguments.json +4 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/copy.js +15 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/cp.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/help.txt +67 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/list.js +129 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/remove.js +229 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/rename.js +4 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/restart.js +235 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/start.js +394 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/status.js +3 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/stop.js +232 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/add.js +436 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/get.js +62 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/help.txt +33 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/link-dev.js +80 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/list.js +111 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/remove.js +150 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/set.js +57 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/unset.js +44 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/use.js +79 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/dot.js +70 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/get.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/help.js +39 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/help.txt +31 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/init.js +514 -0
- package/{core/utils/lib/cmd → framework/v0.1.1-alpha.3/lib/cmd/framework}/msg.json +3 -3
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/open.js +50 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/restart.js +124 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/set.js +161 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/start.js +96 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/status.js +72 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/stop.js +159 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/tail.js +183 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/update.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/version.js +44 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/gina-dev.1.md +66 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/gina-framework.1.md +100 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/gina.1.md +79 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/helper.js +1147 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/index.js +170 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/msg.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/help.txt +31 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/inc/scan.js +108 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/list.js +176 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/set.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/add.js +528 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/arguments.json +9 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/build.js +115 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/help.txt +76 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/import.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/list.js +55 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/move.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/remove.js +144 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/rename.js +162 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/restart.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/start.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/status.js +3 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/stop.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/help.js +27 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/help.txt +57 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/list.js +239 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/set.js +631 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/help.txt +33 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/link-local.js +80 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/list.js +116 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/remove.js +150 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/set.js +57 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/unset.js +44 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/use.js +79 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/view/add.js +311 -0
- package/framework/v0.1.1-alpha.3/lib/collection/README.md +5 -0
- package/framework/v0.1.1-alpha.3/lib/collection/build.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/collection/package.json +2 -2
- package/framework/v0.1.1-alpha.3/lib/collection/src/main.js +1459 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/config.js +49 -34
- package/framework/v0.1.1-alpha.3/lib/cron/README.md +7 -0
- package/framework/v0.1.1-alpha.3/lib/cron/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/cron/src/main.js +176 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/generator/index.js +8 -4
- package/framework/v0.1.1-alpha.3/lib/index.js +116 -0
- package/framework/v0.1.1-alpha.3/lib/inherits/LICENSE +19 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/README.md +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/inheriting_eventemitter.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/protected_inheritance.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/simple_inheritance.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/package.json +2 -2
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/src/main.js +18 -19
- package/framework/v0.1.1-alpha.3/lib/logger/README.md +7 -0
- package/framework/v0.1.1-alpha.3/lib/logger/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/default/index.js +55 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/file/index.js +251 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/file/lib/logrotator/README.md +100 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/file/lib/logrotator/index.js +274 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/mq/index.js +52 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/mq/listener.js +302 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/mq/speaker.js +118 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/helper.js +131 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/main.js +739 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/math/index.js +58 -35
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/README.md +5 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/example/merge.js +1 -1
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/example/merge_2_literal objects.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/example/merge_and_preserve_first.js +2 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/package.json +2 -2
- package/framework/v0.1.1-alpha.3/lib/merge/src/main.js +531 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/model.js +42 -19
- package/framework/v0.1.1-alpha.3/lib/proc.js +518 -0
- package/framework/v0.1.1-alpha.3/lib/routing/README.md +0 -0
- package/framework/v0.1.1-alpha.3/lib/routing/build.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/routing/package.json +2 -2
- package/framework/v0.1.1-alpha.3/lib/routing/src/main.js +1492 -0
- package/framework/v0.1.1-alpha.3/lib/session-store.js +33 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/shell.js +43 -30
- package/framework/v0.1.1-alpha.3/lib/swig-filters/README.md +0 -0
- package/framework/v0.1.1-alpha.3/lib/swig-filters/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/swig-filters/src/main.js +322 -0
- package/framework/v0.1.1-alpha.3/lib/url/README.md +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/index.js +2 -1
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/mocks.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/routing.json +9 -9
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/test.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/validator.js +7 -7
- package/framework/v0.1.1-alpha.3/package.json +14 -0
- package/package.json +35 -33
- package/resources/etc/init.d/debian/gina +117 -0
- package/resources/home/framework/env.json +34 -0
- package/resources/home/framework/locals.json +14 -0
- package/resources/home/framework/project.json +48 -0
- package/resources/home/framework/projects.json +6 -0
- package/resources/home/main.json +47 -0
- package/resources/home/settings.json +22 -0
- package/resources/home/user/extensions/logger/default/config.json +77 -0
- package/resources/home/user/extensions/logger/file/config.json +11 -0
- package/resources/img/android-chrome-192x192.png +0 -0
- package/resources/img/android-chrome-512x512.png +0 -0
- package/resources/img/apple-touch-icon.png +0 -0
- package/resources/img/favicon-16x16.png +0 -0
- package/resources/img/favicon-32x32.png +0 -0
- package/resources/img/favicon.ico +0 -0
- package/resources/package.json.template +50 -0
- package/script/lib.js +24 -0
- package/script/post_install.js +449 -157
- package/script/pre_install.js +277 -36
- package/script/prepare_version.js +425 -0
- package/utils/helper.js +438 -0
- package/utils/prototypes.js +239 -0
- package/utils/prototypes.json_clone.js +175 -0
- package/.npmignore +0 -6
- package/MIDDLEWARE +0 -1
- package/SUCCESS +0 -1
- package/VERSION +0 -1
- package/core/asset/html/nolayout.html +0 -1
- package/core/asset/js/plugin/build.dev.json +0 -28
- package/core/asset/js/plugin/build.json +0 -31
- package/core/asset/js/plugin/dist/gina.min.css +0 -1
- package/core/asset/js/plugin/dist/gina.min.css.map +0 -1
- package/core/asset/js/plugin/dist/gina.min.js +0 -13732
- package/core/asset/js/plugin/dist/gina.min.js.map +0 -42
- package/core/asset/js/plugin/dist/gina.onload.min.js +0 -3
- package/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
- package/core/asset/js/plugin/readme.md +0 -152
- package/core/asset/js/plugin/src/gina/main.js +0 -132
- package/core/asset/js/plugin/src/gina/popin/css/design.css +0 -23
- package/core/asset/js/plugin/src/gina/popin/css/main.css +0 -1112
- package/core/asset/js/plugin/src/gina/popin/css/popin.css +0 -3
- package/core/asset/js/plugin/src/gina/popin/css/popin.css.map +0 -1
- package/core/asset/js/plugin/src/gina/popin/doc/TOC.md +0 -29
- package/core/asset/js/plugin/src/gina/popin/doc/css.md +0 -162
- package/core/asset/js/plugin/src/gina/popin/doc/extend.md +0 -663
- package/core/asset/js/plugin/src/gina/popin/doc/faq.md +0 -46
- package/core/asset/js/plugin/src/gina/popin/doc/html.md +0 -227
- package/core/asset/js/plugin/src/gina/popin/doc/js.md +0 -37
- package/core/asset/js/plugin/src/gina/popin/doc/misc.md +0 -178
- package/core/asset/js/plugin/src/gina/popin/doc/usage.md +0 -130
- package/core/asset/js/plugin/src/gina/popin/main.js +0 -783
- package/core/asset/js/plugin/src/gina/popin/sass/config.sass +0 -37
- package/core/asset/js/plugin/src/gina/popin/sass/gina-design.sass +0 -622
- package/core/asset/js/plugin/src/gina/popin/sass/gina-popin.sass +0 -54
- package/core/asset/js/plugin/src/gina/popin/sass/helper.scss +0 -73
- package/core/asset/js/plugin/src/gina/toolbar/.npmignore +0 -19
- package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css +0 -433
- package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css.map +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/index.html +0 -285
- package/core/asset/js/plugin/src/gina/toolbar/index.kit +0 -120
- package/core/asset/js/plugin/src/gina/toolbar/jquery-3.1.0.min.js +0 -4
- package/core/asset/js/plugin/src/gina/toolbar/main.js +0 -693
- package/core/asset/js/plugin/src/gina/toolbar/mock.gina.json +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/mock.user.json +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/readme.md +0 -7
- package/core/asset/js/plugin/src/gina/toolbar/sass/toolbar.sass +0 -563
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/info-optim.svg +0 -13
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/logo-gina.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings-big.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.afdesign +0 -0
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/test.jpg +0 -0
- package/core/asset/js/plugin/src/gina/toolbar/toolbar.html +0 -104
- package/core/asset/js/plugin/src/gina/utils/dom.js +0 -24
- package/core/asset/js/plugin/src/gina/utils/events.js +0 -201
- package/core/asset/js/plugin/src/gina/utils/loader.js +0 -57
- package/core/asset/js/plugin/src/main.js +0 -235
- package/core/asset/js/plugin/src/vendor/jquery/1.11.1-css-event_alias.min.js +0 -5
- package/core/asset/js/plugin/src/vendor/jquery/1.12.4.min.js +0 -5
- package/core/asset/js/plugin/src/vendor/jquery/2.1.1-css-event_alias-sizzle.min.js +0 -4
- package/core/asset/js/plugin/src/vendor/jquery/README.md +0 -14
- package/core/asset/js/plugin/src/vendor/jquery/slim-3.1.1.min.js +0 -4
- package/core/config.js +0 -1225
- package/core/controller/controller.js +0 -1860
- package/core/gna.js +0 -908
- package/core/plugins/lib/validator/src/form-validator.js +0 -789
- package/core/plugins/lib/validator/src/main.js +0 -2056
- package/core/router.js +0 -717
- package/core/server.js +0 -1363
- package/core/template/conf/env.json +0 -70
- package/core/template/conf/settings.json +0 -48
- package/core/template/conf/statics.json +0 -6
- package/core/template/conf/views.json +0 -16
- package/core/template/samples/bundle/config/app.json +0 -4
- package/core/template/samples/bundle/config/routing.json +0 -9
- package/core/template/samples/bundle/controllers/setup.js +0 -33
- package/core/template/views/js/vendor/readme.md +0 -1
- package/core/template/views/readme.md +0 -1
- package/core/utils/helpers/dateFormat.js +0 -264
- package/core/utils/helpers/index.js +0 -202
- package/core/utils/index.js +0 -75
- package/core/utils/lib/cmd/app.js +0 -686
- package/core/utils/lib/cmd/basic.help.txt +0 -40
- package/core/utils/lib/cmd/basic.js +0 -141
- package/core/utils/lib/cmd/gina-add-bundle.js +0 -328
- package/core/utils/lib/cmd/gina-add-views.js +0 -99
- package/core/utils/lib/cmd/gina-build.js +0 -218
- package/core/utils/lib/cmd/gina-clean.js +0 -26
- package/core/utils/lib/cmd/gina-connect.js +0 -176
- package/core/utils/lib/cmd/gina-delete-bundle.js +0 -176
- package/core/utils/lib/cmd/gina-deploy.js +0 -452
- package/core/utils/lib/cmd/gina-init-project.js +0 -83
- package/core/utils/lib/cmd/gina-start-bundle.js +0 -3
- package/core/utils/lib/cmd/gina-start.js +0 -3
- package/core/utils/lib/cmd/index.js +0 -157
- package/core/utils/lib/cmd/project.js +0 -14
- package/core/utils/lib/collection/src/main.js +0 -650
- package/core/utils/lib/logger/containers/file.js +0 -11
- package/core/utils/lib/logger/index.js +0 -260
- package/core/utils/lib/merge/src/main.js +0 -344
- package/core/utils/lib/proc.js +0 -416
- package/core/utils/lib/routing/src/main.js +0 -165
- package/documentation/css/default.css +0 -3
- package/documentation/html/home.html +0 -6
- package/documentation/html/inc/_footer.html +0 -5
- package/documentation/html/layout.html +0 -21
- package/documentation/img/debug-conf1.png +0 -0
- package/documentation/img/debug-conf2.png +0 -0
- package/documentation/img/debug-conf3.png +0 -0
- package/documentation/img/debug-conf4.png +0 -0
- package/documentation/img/debug-conf5.png +0 -0
- package/documentation/img/debug-conf6.png +0 -0
- package/documentation/img/debug-conf7.png +0 -0
- package/documentation/img/debug-new1.png +0 -0
- package/documentation/img/debug-new2.png +0 -0
- package/documentation/img/debug-start.png +0 -0
- package/documentation/md/api/controller/main.md +0 -74
- package/migration_note.md +0 -7
- package/package-lock.json +0 -611
- package/script/pre_publish.js +0 -207
- package/tutorial/Commands/README.md +0 -56
- package/tutorial/Commands/add-bundle-result.png +0 -0
- package/tutorial/Commands/add-bundle.png +0 -0
- package/tutorial/Commands/delete-bundle.png +0 -0
- package/tutorial/Commands/help.png +0 -0
- package/tutorial/Commands/init-project.png +0 -0
- package/tutorial/Commands/start-bundle-result.png +0 -0
- package/tutorial/Commands/start-bundle-stop.png +0 -0
- package/tutorial/Commands/start-bundle.png +0 -0
- package/tutorial/Commands/version.png +0 -0
- package/tutorial/ETC/README.md +0 -74
- package/tutorial/ETC/add-bundle-result.png +0 -0
- package/tutorial/ETC/add-bundle.png +0 -0
- package/tutorial/ETC/init-project.png +0 -0
- package/tutorial/Install/README.md +0 -54
- package/tutorial/Install/git-get.png +0 -0
- package/tutorial/Install/git-install-end.png +0 -0
- package/tutorial/Install/git-install-result.png +0 -0
- package/tutorial/Install/git-install-start.png +0 -0
- package/tutorial/Install/install-end.png +0 -0
- package/tutorial/Install/install-result.png +0 -0
- package/tutorial/Install/install-start.png +0 -0
- package/tutorial/WebStorm/README.md +0 -30
- package/tutorial/WebStorm/closure-compiler.png +0 -0
- package/tutorial/WebStorm/sass.png +0 -0
package/core/router.js
DELETED
|
@@ -1,717 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of the gina package.
|
|
3
|
-
* Copyright (c) 2016 Rhinostone <gina@rhinostone.com>
|
|
4
|
-
*
|
|
5
|
-
* For the full copyright and license information, please view the LICENSE
|
|
6
|
-
* file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
//Imports.
|
|
11
|
-
|
|
12
|
-
var url = require('url')
|
|
13
|
-
, fs = require('fs')
|
|
14
|
-
, utils = require('./utils')
|
|
15
|
-
, console = utils.logger
|
|
16
|
-
, inherits = utils.inherits
|
|
17
|
-
, merge = utils.merge
|
|
18
|
-
, SuperController = require('./controller')
|
|
19
|
-
, Config = require('./config')
|
|
20
|
-
//get config instance
|
|
21
|
-
, config = new Config();
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @class Router
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @package Gina
|
|
28
|
-
* @namespace
|
|
29
|
-
* @author Rhinostone <gina@rhinostone.com>
|
|
30
|
-
* @api Public
|
|
31
|
-
*/
|
|
32
|
-
function Router(env) {
|
|
33
|
-
|
|
34
|
-
this.name = 'Router';
|
|
35
|
-
var self = this
|
|
36
|
-
, local = {
|
|
37
|
-
conf : config.getInstance(),
|
|
38
|
-
bundle : null
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Router Constructor
|
|
43
|
-
* @constructor
|
|
44
|
-
* */
|
|
45
|
-
var init = function(){
|
|
46
|
-
if ( typeof(Router.initialized) != "undefined" ) {
|
|
47
|
-
return self.getInstance()
|
|
48
|
-
} else {
|
|
49
|
-
Router.initialized = true
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
this.setMiddlewareInstance = function(instance) {
|
|
54
|
-
self.middlewareInstance = instance
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
this.getInstance = function() {
|
|
58
|
-
return self
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Compare urls
|
|
64
|
-
*
|
|
65
|
-
* @param {object} request
|
|
66
|
-
* @param {object} params - Route params
|
|
67
|
-
* @param {string} urlRouting
|
|
68
|
-
*
|
|
69
|
-
* @return {object|false} routes
|
|
70
|
-
* */
|
|
71
|
-
this.compareUrls = function(request, params, urlRouting) {
|
|
72
|
-
|
|
73
|
-
if ( Array.isArray(urlRouting) ) {
|
|
74
|
-
var i = 0
|
|
75
|
-
, res = {
|
|
76
|
-
past : false,
|
|
77
|
-
request : request
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
while (i < urlRouting.length && !res.past) {
|
|
81
|
-
res = parseRouting(request, params, urlRouting[i]);
|
|
82
|
-
++i
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return res
|
|
86
|
-
} else {
|
|
87
|
-
return parseRouting(request, params, urlRouting)
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Check if rule has params
|
|
93
|
-
*
|
|
94
|
-
* @param {string} pathname
|
|
95
|
-
* @return {boolean} found
|
|
96
|
-
*
|
|
97
|
-
* @private
|
|
98
|
-
* */
|
|
99
|
-
var hasParams = function(pathname) {
|
|
100
|
-
return ( /:/.test(pathname) ) ? true : false
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Parse routing for mathcing url
|
|
105
|
-
*
|
|
106
|
-
* @param {object} request
|
|
107
|
-
* @param {object} params
|
|
108
|
-
* @param {string} route
|
|
109
|
-
*
|
|
110
|
-
* @return
|
|
111
|
-
*
|
|
112
|
-
* */
|
|
113
|
-
var parseRouting = function(request, params, route) {
|
|
114
|
-
var uRe = params.url.split(/\//)
|
|
115
|
-
, uRo = route.split(/\//)
|
|
116
|
-
, maxLen = uRo.length
|
|
117
|
-
, score = 0
|
|
118
|
-
, r = {}
|
|
119
|
-
, i = 0;
|
|
120
|
-
|
|
121
|
-
//attaching routing description for this request
|
|
122
|
-
request.routing = params; // can be retried in controller with: req.routing
|
|
123
|
-
|
|
124
|
-
if (uRe.length === uRo.length) {
|
|
125
|
-
for (; i<maxLen; ++i) {
|
|
126
|
-
if (uRe[i] === uRo[i]) {
|
|
127
|
-
++score
|
|
128
|
-
} else if (score == i && hasParams(uRo[i]) && fitsWithRequirements(request, uRo[i], uRe[i], params)) {
|
|
129
|
-
++score
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
r.past = (score === maxLen) ? true : false;
|
|
135
|
-
r.request = request;
|
|
136
|
-
|
|
137
|
-
return r
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Fits with requiremements
|
|
142
|
-
* http://en.wikipedia.org/wiki/Regular_expression
|
|
143
|
-
*
|
|
144
|
-
* @param {string} urlVar
|
|
145
|
-
* @param {string} urlVal
|
|
146
|
-
* @param {object} params
|
|
147
|
-
*
|
|
148
|
-
* @return {boolean} true|false - True if fits
|
|
149
|
-
*
|
|
150
|
-
* @private
|
|
151
|
-
* */
|
|
152
|
-
var fitsWithRequirements = function(request, urlVar, urlVal, params) {
|
|
153
|
-
|
|
154
|
-
var matched = -1
|
|
155
|
-
, _param = urlVar.match(/\:\w+/g)
|
|
156
|
-
, regex = null
|
|
157
|
-
, tested = false;
|
|
158
|
-
|
|
159
|
-
if (!_param.length) return false;
|
|
160
|
-
|
|
161
|
-
// if custom path, path rewrite
|
|
162
|
-
if (request.routing.param.path) {
|
|
163
|
-
regex = new RegExp(urlVar, 'g')
|
|
164
|
-
if ( regex.test(request.routing.param.path) ) {
|
|
165
|
-
request.routing.param.path = request.routing.param.path.replace(regex, urlVal);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// if custom file, file rewrite
|
|
170
|
-
if (request.routing.param.file) {
|
|
171
|
-
regex = new RegExp(urlVar, 'g')
|
|
172
|
-
if ( regex.test(request.routing.param.file) ) {
|
|
173
|
-
request.routing.param.file = request.routing.param.file.replace(regex, urlVal);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (_param.length == 1) {// fast one
|
|
178
|
-
matched = ( _param.indexOf(urlVar) > -1 ) ? _param.indexOf(urlVar) : false;
|
|
179
|
-
|
|
180
|
-
if (matched === false) return matched;
|
|
181
|
-
// filter on method
|
|
182
|
-
if (params.method !== request.method) return false;
|
|
183
|
-
|
|
184
|
-
var key = _param[matched].substr(1);
|
|
185
|
-
regex = params.requirements[key];
|
|
186
|
-
|
|
187
|
-
if ( /^\//.test(regex) ) {
|
|
188
|
-
var re = regex.match(/\/(.*)\//).pop()
|
|
189
|
-
, flags = regex.replace('/'+ re +'/', '');
|
|
190
|
-
|
|
191
|
-
tested = new RegExp(re, flags).test( urlVal )
|
|
192
|
-
|
|
193
|
-
} else {
|
|
194
|
-
tested = new RegExp(params.requirements[key]).test( urlVal )
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (
|
|
198
|
-
typeof(params.param[key]) != 'undefined' &&
|
|
199
|
-
typeof(params.requirements) != 'undefined' &&
|
|
200
|
-
typeof(params.requirements[key]) != 'undefined' &&
|
|
201
|
-
tested
|
|
202
|
-
) {
|
|
203
|
-
request.params[key] = urlVal;
|
|
204
|
-
return true
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
} else { // slow one
|
|
208
|
-
|
|
209
|
-
// In order to support rules defined like :
|
|
210
|
-
// { params.url } => `/section/:name/page:number`
|
|
211
|
-
// { request.url } => `/section/plante/page4`
|
|
212
|
-
//
|
|
213
|
-
// with keys = [ ":name", ":number" ]
|
|
214
|
-
|
|
215
|
-
var keys = _param
|
|
216
|
-
, tplUrl = params.url
|
|
217
|
-
, url = request.url
|
|
218
|
-
, values = {}
|
|
219
|
-
, strVal = ''
|
|
220
|
-
, started = false
|
|
221
|
-
, i = 0;
|
|
222
|
-
|
|
223
|
-
for (var c = 0, posLen = url.length; c < posLen; ++c) {
|
|
224
|
-
if (url.charAt(c) == tplUrl.charAt(i) && !started) {
|
|
225
|
-
++i
|
|
226
|
-
continue
|
|
227
|
-
} else if (strVal == '') { // start
|
|
228
|
-
|
|
229
|
-
started = true;
|
|
230
|
-
strVal += url.charAt(c);
|
|
231
|
-
} else if ( c > (tplUrl.indexOf(keys[0]) + keys[0].length) ) {
|
|
232
|
-
|
|
233
|
-
regex = params.requirements[keys[0]];
|
|
234
|
-
urlVal = strVal.substr(0, strVal.length);
|
|
235
|
-
|
|
236
|
-
if ( /^\//.test(regex) ) {
|
|
237
|
-
var re = regex.match(/\/(.*)\//).pop()
|
|
238
|
-
, flags = regex.replace('/'+ re +'/', '');
|
|
239
|
-
|
|
240
|
-
tested = new RegExp(re, flags).test( urlVal )
|
|
241
|
-
|
|
242
|
-
} else {
|
|
243
|
-
tested = new RegExp(params.requirements[key]).test( urlVal )
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (tested) {
|
|
247
|
-
values[ keys[0].substr(1) ] = urlVal
|
|
248
|
-
} else {
|
|
249
|
-
return false
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
strVal = '';
|
|
253
|
-
started = false;
|
|
254
|
-
i = (tplUrl.indexOf(keys[0]) + keys[0].length);
|
|
255
|
-
c -= 1;
|
|
256
|
-
|
|
257
|
-
keys.splice(0,1)
|
|
258
|
-
} else {
|
|
259
|
-
strVal += url.charAt(c);
|
|
260
|
-
++i
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if (c == posLen - 1 ) {
|
|
264
|
-
|
|
265
|
-
regex = params.requirements[keys[0]];
|
|
266
|
-
urlVal = strVal.substr(0, strVal.length);
|
|
267
|
-
|
|
268
|
-
if ( /^\//.test(regex) ) {
|
|
269
|
-
var re = regex.match(/\/(.*)\//).pop()
|
|
270
|
-
, flags = regex.replace('/'+ re +'/', '');
|
|
271
|
-
|
|
272
|
-
tested = new RegExp(re, flags).test( urlVal )
|
|
273
|
-
|
|
274
|
-
} else {
|
|
275
|
-
tested = new RegExp(params.requirements[key]).test( urlVal )
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
if (tested) {
|
|
279
|
-
values[ keys[0].substr(1) ] = urlVal
|
|
280
|
-
} else {
|
|
281
|
-
return false
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
if (values.count() == keys.length) {
|
|
289
|
-
for (var key in values) {
|
|
290
|
-
request.params[key] = values[key];
|
|
291
|
-
}
|
|
292
|
-
return true
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return false
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
var refreshCore = function() {
|
|
301
|
-
//var corePath = getPath('gina.core');
|
|
302
|
-
var corePath = getPath('gina').core;
|
|
303
|
-
var core = new RegExp( corePath );
|
|
304
|
-
var excluded = [
|
|
305
|
-
_(corePath + '/gna.js', true)
|
|
306
|
-
];
|
|
307
|
-
|
|
308
|
-
for (var c in require.cache) {
|
|
309
|
-
if ( (core).test(c) && excluded.indexOf(c) < 0 ) {
|
|
310
|
-
require.cache[c].exports = require( _(c, true) )
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
//update utils
|
|
315
|
-
delete require.cache[_(corePath +'/utils/index.js', true)];
|
|
316
|
-
require.cache[_(corePath +'/utils/index.js', true)] = require( _(corePath +'/utils/index.js', true) );
|
|
317
|
-
require.cache[_(corePath + '/gna.js', true)].exports.utils = require.cache[_(corePath +'/utils/index.js', true)];
|
|
318
|
-
|
|
319
|
-
//update plugins
|
|
320
|
-
delete require.cache[_(corePath +'/plugins/index.js', true)];
|
|
321
|
-
require.cache[_(corePath +'/plugins/index.js', true)] = require( _(corePath +'/plugins/index.js', true) );
|
|
322
|
-
require.cache[_(corePath + '/gna.js', true)].exports.plugins = require.cache[_(corePath +'/plugins/index.js', true)];
|
|
323
|
-
|
|
324
|
-
// Super controller
|
|
325
|
-
delete require.cache[_(corePath +'/controller/index.js', true)];
|
|
326
|
-
require.cache[_(corePath +'/controller/index.js', true)] = require( _(corePath +'/controller/index.js', true) );
|
|
327
|
-
SuperController = require.cache[_(corePath +'/controller/index.js', true)];
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Route on the fly
|
|
333
|
-
*
|
|
334
|
-
* @param {object} request
|
|
335
|
-
* @param {object} response
|
|
336
|
-
* @param {object} params - Route params
|
|
337
|
-
*
|
|
338
|
-
* @callback next
|
|
339
|
-
* */
|
|
340
|
-
this.route = function(request, response, next, params) {
|
|
341
|
-
|
|
342
|
-
//Routing.
|
|
343
|
-
var pathname = url.parse(request.url).pathname;
|
|
344
|
-
var bundle = local.bundle = params.bundle;
|
|
345
|
-
var conf = config.Env.getConf( bundle, env );
|
|
346
|
-
var bundles = conf.bundles;
|
|
347
|
-
local.request = request;
|
|
348
|
-
local.conf = conf;
|
|
349
|
-
local.isStandalone = config.Host.isStandalone();
|
|
350
|
-
|
|
351
|
-
// for libs/context etc..
|
|
352
|
-
var routerObj = {
|
|
353
|
-
response : response,
|
|
354
|
-
next : next,
|
|
355
|
-
hasViews : ( typeof(conf.content.views) != 'undefined' ) ? true : false,
|
|
356
|
-
isUsingTemplate : conf.template,
|
|
357
|
-
isProcessingXMLRequest : params.isXMLRequest
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
setContext('router', routerObj);
|
|
361
|
-
|
|
362
|
-
var action = request.action = params.param.action;
|
|
363
|
-
// more can be added ... but it will always start by `on`Something.
|
|
364
|
-
var reservedActions = [
|
|
365
|
-
"onReady",
|
|
366
|
-
"setup"
|
|
367
|
-
];
|
|
368
|
-
if (reservedActions.indexOf(action) > -1) throwError(response, 500, '[ '+action+' ] is reserved for the framework');
|
|
369
|
-
var middleware = params.middleware || [];
|
|
370
|
-
var actionFile = params.param.file; // matches rule name
|
|
371
|
-
var namespace = params.namespace;
|
|
372
|
-
var routeHasViews = ( typeof(conf.content.views) != 'undefined' ) ? true : false;
|
|
373
|
-
var isUsingTemplate = conf.template;
|
|
374
|
-
var hasSetup = false;
|
|
375
|
-
var hasNamespace = false;
|
|
376
|
-
|
|
377
|
-
local.routeHasViews = routeHasViews;
|
|
378
|
-
local.isUsingTemplate = isUsingTemplate;
|
|
379
|
-
local.next = next;
|
|
380
|
-
local.isXMLRequest = params.isXMLRequest;
|
|
381
|
-
|
|
382
|
-
var cacheless = (process.env.IS_CACHELESS == 'false') ? false : true;
|
|
383
|
-
local.cacheless = cacheless;
|
|
384
|
-
|
|
385
|
-
if (cacheless) refreshCore();
|
|
386
|
-
|
|
387
|
-
//Middleware Filters when declared.
|
|
388
|
-
var resHeaders = conf.server.response.header;
|
|
389
|
-
//TODO - to test
|
|
390
|
-
if ( resHeaders.count() > 0 ) {
|
|
391
|
-
for (var h in resHeaders) {
|
|
392
|
-
if (!response.headersSent)
|
|
393
|
-
response.setHeader(h, resHeaders[h])
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
//console.debug('ACTION ON ROUTING IS : ' + action);
|
|
398
|
-
|
|
399
|
-
//Getting superCleasses & extending it with super Models.
|
|
400
|
-
var controllerFile = {}
|
|
401
|
-
, setupFile = {}
|
|
402
|
-
, Controller = {};
|
|
403
|
-
|
|
404
|
-
// TODO - ?? merge all controllers into a single file while building for other env than `dev`
|
|
405
|
-
|
|
406
|
-
setupFile = conf.bundlesPath +'/'+ bundle + '/controllers/setup.js';
|
|
407
|
-
var filename = '';
|
|
408
|
-
if (namespace) {
|
|
409
|
-
filename = conf.bundlesPath +'/'+ bundle + '/controllers/controller.'+ namespace +'.js';
|
|
410
|
-
if ( !fs.existsSync(filename) ) {
|
|
411
|
-
filename = conf.bundlesPath +'/'+ bundle + '/controllers/controller.js';
|
|
412
|
-
console.warn('namespace found, but no `'+filename+'` to load: just ignore this message if this is ok with you')
|
|
413
|
-
}
|
|
414
|
-
} else {
|
|
415
|
-
filename = conf.bundlesPath +'/'+ bundle + '/controllers/controller.js';
|
|
416
|
-
}
|
|
417
|
-
controllerFile = filename
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
// default param setting
|
|
421
|
-
var options = {
|
|
422
|
-
file : actionFile,
|
|
423
|
-
namespace : namespace,
|
|
424
|
-
bundle : bundle,//module
|
|
425
|
-
bundlePath : conf.bundlesPath +'/'+ bundle,
|
|
426
|
-
rootPath : self.executionPath,
|
|
427
|
-
conf : conf,
|
|
428
|
-
instance : self.middlewareInstance,
|
|
429
|
-
views : ( routeHasViews ) ? conf.content.views : undefined,
|
|
430
|
-
isUsingTemplate : local.isUsingTemplate,
|
|
431
|
-
cacheless : cacheless,
|
|
432
|
-
rule : params.rule,
|
|
433
|
-
path : params.param.path || null, // user custom path : namespace should be ignored | left blank
|
|
434
|
-
isXMLRequest : params.isXMLRequest,
|
|
435
|
-
withCredentials : false
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
for (var p in params.param) {
|
|
439
|
-
options[p] = params.param[p]
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
try {
|
|
443
|
-
|
|
444
|
-
if ( fs.existsSync(_(setupFile, true)) )
|
|
445
|
-
hasSetup = true;
|
|
446
|
-
|
|
447
|
-
if (cacheless) {
|
|
448
|
-
|
|
449
|
-
delete require.cache[_(controllerFile, true)];
|
|
450
|
-
|
|
451
|
-
if ( hasSetup )
|
|
452
|
-
delete require.cache[_(setupFile, true)];
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
Controller = require(_(controllerFile, true));
|
|
456
|
-
|
|
457
|
-
} catch (err) {
|
|
458
|
-
// means that you have a syntax errors in you controller file
|
|
459
|
-
// TODO - increase `stack-trace` from 10 (default value) to 500 or more to get the exact error --stack-trace-limit=1000
|
|
460
|
-
// TODO - also check `stack-size` why not set it to at the same time => --stack-size=1024
|
|
461
|
-
throwError(response, 500, new Error('syntax error(s) found in `'+ controllerFile +'` \nTrace: ') + (err.stack || err.message) );
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
// about to contact Controller ...
|
|
465
|
-
try {
|
|
466
|
-
|
|
467
|
-
Controller = inherits(Controller, SuperController);
|
|
468
|
-
|
|
469
|
-
var controller = new Controller(options);
|
|
470
|
-
|
|
471
|
-
controller.setOptions(request, response, next, options);
|
|
472
|
-
|
|
473
|
-
if (hasSetup) { // adding setup
|
|
474
|
-
controller.setup = function(request, response, next) {
|
|
475
|
-
if (!this._setupDone) {
|
|
476
|
-
this._setupDone = true;
|
|
477
|
-
return function (request, response, next) { // getting rid of the controller context
|
|
478
|
-
var Setup = require(_(setupFile, true));
|
|
479
|
-
|
|
480
|
-
// TODO - loop on a defiend SuperController property like SuperController._allowedForExport
|
|
481
|
-
// inheriting SuperController functions & objects
|
|
482
|
-
|
|
483
|
-
// exporting config & common methods
|
|
484
|
-
Setup.engine = controller.engine;
|
|
485
|
-
Setup.getConfig = controller.getConfig;
|
|
486
|
-
Setup.getLocales = controller.getLocales;
|
|
487
|
-
Setup.getFormsRules = controller.getFormsRules;
|
|
488
|
-
Setup.throwError = controller.throwError;
|
|
489
|
-
Setup.redirect = controller.redirect;
|
|
490
|
-
Setup.render = controller.render;
|
|
491
|
-
Setup.renderJSON = controller.renderJSON;
|
|
492
|
-
Setup.renderWithoutLayout = controller.renderWithoutLayout
|
|
493
|
-
Setup.isXMLRequest = controller.isXMLRequest;
|
|
494
|
-
Setup.isWithCredentials = controller.isWithCredentials,
|
|
495
|
-
Setup.isCacheless = controller.isCacheless;
|
|
496
|
-
|
|
497
|
-
Setup.apply(Setup, arguments);
|
|
498
|
-
|
|
499
|
-
return Setup;
|
|
500
|
-
}(request, response, next)
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
// allowing another controller (public methods) to be required inside the current controller
|
|
506
|
-
/**
|
|
507
|
-
* requireController
|
|
508
|
-
* Allowing another controller (public methods) to be required inside the current controller
|
|
509
|
-
*
|
|
510
|
-
* @param {string} namespace - Controller namespace
|
|
511
|
-
* @param {object} [options] - Controller options
|
|
512
|
-
*
|
|
513
|
-
* @return {object} controllerInstance
|
|
514
|
-
* */
|
|
515
|
-
controller.requireController = function (namespace, options) {
|
|
516
|
-
|
|
517
|
-
var cacheless = (process.env.IS_CACHELESS == 'false') ? false : true;
|
|
518
|
-
var corePath = getPath('gina').core;
|
|
519
|
-
var config = getContext('gina').Config.instance;
|
|
520
|
-
var bundle = config.bundle;
|
|
521
|
-
var env = config.env;
|
|
522
|
-
var bundleConf = config.Env.getConf(bundle, env);
|
|
523
|
-
|
|
524
|
-
var filename = _(bundleConf.bundlesPath +'/'+ bundle + '/controllers/' + namespace + '.js', true);
|
|
525
|
-
|
|
526
|
-
try {
|
|
527
|
-
|
|
528
|
-
if (cacheless) {
|
|
529
|
-
// Super controller
|
|
530
|
-
delete require.cache[_(corePath +'/controller/index.js', true)];
|
|
531
|
-
require.cache[_(corePath +'/controller/index.js', true)] = require( _(corePath +'/controller/index.js', true) );
|
|
532
|
-
|
|
533
|
-
delete require.cache[filename];
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
var SuperController = require.cache[_(corePath +'/controller/index.js', true)];
|
|
537
|
-
var RequiredController = require(filename);
|
|
538
|
-
|
|
539
|
-
var RequiredController = inherits(RequiredController, SuperController)
|
|
540
|
-
|
|
541
|
-
if ( typeof(options) != 'undefined' ) {
|
|
542
|
-
|
|
543
|
-
var controller = new RequiredController( options );
|
|
544
|
-
controller.setOptions(request, response, next, options);
|
|
545
|
-
|
|
546
|
-
return controller
|
|
547
|
-
|
|
548
|
-
} else {
|
|
549
|
-
return new RequiredController();
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
} catch (err) {
|
|
553
|
-
throwError(response, 500, err );
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
if (middleware.length > 0) {
|
|
558
|
-
processMiddlewares(middleware, controller, action, request, response, next,
|
|
559
|
-
function onDone(action, request, response, next){
|
|
560
|
-
// handle superController events
|
|
561
|
-
for (var e=0; e<reservedActions.length; ++e) {
|
|
562
|
-
if ( typeof(controller[reservedActions[e]]) == 'function' ) {
|
|
563
|
-
controller[reservedActions[e]](request, response, next)
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
controller[action](request, response, next)
|
|
567
|
-
})
|
|
568
|
-
} else {
|
|
569
|
-
// handle superController events
|
|
570
|
-
// e.g.: inside your controller, you can defined: `this.onReady = function(){...}` which will always be called before the main action
|
|
571
|
-
for (var e=0; e<reservedActions.length; ++e) {
|
|
572
|
-
if ( typeof(controller[reservedActions[e]]) == 'function' ) {
|
|
573
|
-
controller[reservedActions[e]](request, response, next)
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
controller[action](request, response, next)
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
} catch (err) {
|
|
580
|
-
var superController = new SuperController(options);
|
|
581
|
-
superController.setOptions(request, response, next, options);
|
|
582
|
-
if ( typeof(controller) != 'undefined' && typeof(controller[action]) == 'undefined') {
|
|
583
|
-
superController.throwError(response, 500, (new Error('action not found: `'+ action+'`. Please, check your routing.json or the related control in your `'+controllerFile+'`.')).stack);
|
|
584
|
-
} else {
|
|
585
|
-
superController.throwError(response, 500, err.stack);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
action = null
|
|
590
|
-
};//EO route()
|
|
591
|
-
|
|
592
|
-
var processMiddlewares = function(middlewares, controller, action, req, res, next, cb){
|
|
593
|
-
|
|
594
|
-
var filename = _(local.conf.bundlePath)
|
|
595
|
-
, middleware = null
|
|
596
|
-
, constructor = null
|
|
597
|
-
, re = new RegExp('^'+filename);
|
|
598
|
-
|
|
599
|
-
if ( middlewares.length > 0 ) {
|
|
600
|
-
for (var m=0; m<middlewares.length; ++m) {
|
|
601
|
-
constructor = middlewares[m].split(/\./g);
|
|
602
|
-
constructor = constructor
|
|
603
|
-
.splice(constructor.length-1,1)
|
|
604
|
-
.toString();
|
|
605
|
-
middleware = middlewares[m].split(/\./g);
|
|
606
|
-
middleware.splice(middleware.length-1);
|
|
607
|
-
middleware = middleware.join('/');
|
|
608
|
-
filename = _(filename +'/'+ middleware + '/index.js');
|
|
609
|
-
if ( !fs.existsSync( filename ) ) {
|
|
610
|
-
// no middleware found with this alias
|
|
611
|
-
throwError(res, 501, new Error('middleware not found '+ middleware).stack);
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
if (local.cacheless) delete require.cache[_(filename, true)];
|
|
615
|
-
|
|
616
|
-
var MiddlewareClass = function() {
|
|
617
|
-
|
|
618
|
-
return function () { // getting rid of the middleware context
|
|
619
|
-
|
|
620
|
-
var Middleware = require(_(filename, true));
|
|
621
|
-
// TODO - loop on a defiend SuperController property like SuperController._allowedForExport
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
// exporting config & common methods
|
|
625
|
-
//Middleware.engine = controller.engine;
|
|
626
|
-
Middleware.prototype.getConfig = controller.getConfig;
|
|
627
|
-
Middleware.prototype.getLocales = controller.getLocales;
|
|
628
|
-
Middleware.prototype.getFormsRules = controller.getFormsRules;
|
|
629
|
-
Middleware.prototype.throwError = controller.throwError;
|
|
630
|
-
Middleware.prototype.redirect = controller.redirect;
|
|
631
|
-
Middleware.prototype.render = controller.render;
|
|
632
|
-
Middleware.prototype.renderJSON = controller.renderJSON;
|
|
633
|
-
Middleware.prototype.renderWithoutLayout = controller.renderWithoutLayout
|
|
634
|
-
Middleware.prototype.isXMLRequest = controller.isXMLRequest;
|
|
635
|
-
Middleware.prototype.isWithCredentials = controller.isWithCredentials;
|
|
636
|
-
Middleware.prototype.isCacheless = controller.isCacheless;
|
|
637
|
-
|
|
638
|
-
return Middleware;
|
|
639
|
-
}()
|
|
640
|
-
}();
|
|
641
|
-
|
|
642
|
-
middleware = new MiddlewareClass();
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
if ( !middleware[constructor] ) {
|
|
646
|
-
throwError(res, 501, new Error('contructor [ '+constructor+' ] not found @'+ middlewares[m]).stack);
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
if ( typeof(middleware[constructor]) != 'undefined') {
|
|
650
|
-
|
|
651
|
-
middleware[constructor](req, res, next,
|
|
652
|
-
function onMiddlewareProcessed(req, res, next){
|
|
653
|
-
middlewares.splice(m, 1);
|
|
654
|
-
if (middlewares.length > 0) {
|
|
655
|
-
processMiddlewares(middlewares, controller, action, req, res, next, cb)
|
|
656
|
-
} else {
|
|
657
|
-
cb(action, req, res, next)
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
);
|
|
661
|
-
|
|
662
|
-
break
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
} else {
|
|
667
|
-
cb(action, req, res, next)
|
|
668
|
-
}
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
var hasViews = function() {
|
|
672
|
-
return local.routeHasViews;
|
|
673
|
-
};
|
|
674
|
-
|
|
675
|
-
var throwError = function(res, code, msg) {
|
|
676
|
-
if (arguments.length < 3) {
|
|
677
|
-
var msg = code || null
|
|
678
|
-
, code = res || 500
|
|
679
|
-
, res = local.res;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
if (!res.headersSent) {
|
|
683
|
-
if (local.isXMLRequest || !hasViews() || !local.isUsingTemplate) {
|
|
684
|
-
// Internet Explorer override
|
|
685
|
-
if ( /msie/i.test(local.request.headers['user-agent']) ) {
|
|
686
|
-
res.writeHead(code, "Content-Type", "text/plain")
|
|
687
|
-
} else {
|
|
688
|
-
res.writeHead(code, { 'Content-Type': 'application/json'} )
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
console.error(res.req.method +' [ '+code+' ] '+ res.req.url)
|
|
692
|
-
|
|
693
|
-
var e = {
|
|
694
|
-
status: code,
|
|
695
|
-
error: msg
|
|
696
|
-
};
|
|
697
|
-
|
|
698
|
-
if ( typeof(msg) == 'object' && typeof(msg.stack) != 'undefined' ) {
|
|
699
|
-
e.error.stack = msg.stack;
|
|
700
|
-
e.error.message = msg.message;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
res.end(JSON.stringify(err))
|
|
704
|
-
} else {
|
|
705
|
-
res.writeHead(code, { 'Content-Type': 'text/html'} );
|
|
706
|
-
console.error(res.req.method +' [ '+code+' ] '+ res.req.url);
|
|
707
|
-
res.end('<h1>Error '+ code +'.</h1><pre>'+ msg + '</pre>', local.next);
|
|
708
|
-
}
|
|
709
|
-
} else {
|
|
710
|
-
local.next()
|
|
711
|
-
}
|
|
712
|
-
};
|
|
713
|
-
|
|
714
|
-
init()
|
|
715
|
-
};
|
|
716
|
-
|
|
717
|
-
module.exports = Router
|