Using profoundjs in a webserver
Posted: Wed Jan 03, 2018 5:41 am
Hi,
we have set up a webserver by following the details on this webpage:
https://www.ibm.com/developerworks/ibmi ... index.html
This all worked fine (dspsysval.js), but now we want to expand the function of the webserver to run profoundjs-fibers (amongst other things).
I've copied dspsysval.js, stripped out the sysval stuff and added a require command for profoundjs-fibers:
If I take out "var Fiber..." it works fine and outputs '1', based on this url:
http://myi:10011/get_emp.jsx?key=1
But with the require in for Fibers I get a server 500 error:
I know that profoundjs fibers work fine and are installed correctly as I am able to successfully run a node app that uses fibers in qp2term without errors.
Do we need to change some config to allow fibers to be included in a webserver?
We have tried giving QTMHHTTP allobj in case it was an authority issue, but this hasn't fixed it.
Many thanks
Zoe
we have set up a webserver by following the details on this webpage:
https://www.ibm.com/developerworks/ibmi ... index.html
This all worked fine (dspsysval.js), but now we want to expand the function of the webserver to run profoundjs-fibers (amongst other things).
I've copied dspsysval.js, stripped out the sysval stuff and added a require command for profoundjs-fibers:
Code: Select all
var url = require('url');
var db = require('/QOpenSys/QIBM/ProdData/Node/os400/db2i/lib/db2');
var Fiber = require("/QOpenSys/QIBM/ProdData/OPS/Node6/lib/node_modules/profoundjs/node_modules/profoundjs-fibers");
var returnName;
exports.process = function(req, res) { // Implement the interface 'process()'
var key = url.parse(req.url, true).query.key.toUpperCase(); // Get the query key from the URL.
res.writeHead(200, {'Content-Type': 'text/plain'});
//res.writeHead(200, {'Content-Type': 'text/html'});
res.end('key = ' + key); // Write the system value to the HTTP response.
};
http://myi:10011/get_emp.jsx?key=1
But with the require in for Fibers I get a server 500 error:
Code: Select all
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Do we need to change some config to allow fibers to be included in a webserver?
We have tried giving QTMHHTTP allobj in case it was an authority issue, but this hasn't fixed it.
Many thanks
Zoe