node.js - Hosting API generated using loopback.io to Azure using IISNode -
so trying undocumented. built simple rest api using loopback.io in nodejs , want host azure websites. forked https://github.com/strongloop/loopback-getting-started , followed steps described on https://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-develop-deploy-mac/
i able push files , deployment not sure how iisnode start application, because server.js located under /server/server.js iisnode fails find server.js @ root , doesn't create web.config.
i came across point iisnode @ server.js file nested in folder in iis website unable make work locally well. tried
- create server.js on root level contents
require(__dirname + '\\server\\server.js')();
- noticed loopback starts application "node .", inferred uses main module define in packages.json changed main module location "/server/server.js" "server.js"
{ "name": "sample", "version": "1.0.0", "main": "server.js", "scripts": { "pretest": "jshint ." }, "dependencies": { "compression": "^1.0.3", "cors": "^2.5.2", "errorhandler": "^1.1.1", "loopback": "^2.14.0", "loopback-boot": "^2.6.5", "loopback-datasource-juggler": "^2.19.0", "serve-favicon": "^2.0.1" }, "optionaldependencies": { "loopback-explorer": "^1.1.0" }, "devdependencies": { "jshint": "^2.5.6" }, "repository": { "type": "", "url": "" }, "description": "sample" }
after these 2 changes when run "node ." find following error
c:\users\anirudh\documents\github\sample\node_modules\loopback\node_modules\express\lib\router\index.js:138 debug('dispatching %s %s', req.method, req.url); ^ typeerror: cannot read property 'method' of undefined @ function.handle (c:\users\anirudh\documents\github\sample\node_modules\loopback\node_modules\express\lib\router\index.js:138:33) @ eventemitter.handle (c:\users\anirudh\documents\github\sample\node_modules\loopback\node_modules\express\lib\application.js:173:10) @ app (c:\users\anirudh\documents\github\sample\node_modules\loopback\node_modules\express\lib\express.js:38:9) @ object.<anonymous> (c:\users\anirudh\documents\github\sample\server.js:1:105) @ module._compile (module.js:460:26) @ object.module._extensions..js (module.js:478:10) @ module.load (module.js:355:32) @ function.module._load (module.js:310:12) @ function.module.runmain (module.js:501:10) @ startup (node.js:129:16)
i not sure missing, appreciated
i think better way go create .deployment file @ root of project points kudu (that's scm (service control manager) azure uses take deployed site, figure out is, condition it, , make work on iis) right directory in deployment files.
it's easy. create new text file in root of directory called .deployment
, put in it...
[config] project = server
that tell deployment script server folder root of site. hope works you!
Comments
Post a Comment