Hi Rob, in addition to Christian’s mail, one more thought:
Great, angular2, haven’t had more than a brief look at it so far :-) I guess you are using that NodeJS-application to serve and generate your AngularJS-files, right? Or are there any other reasons you need NodeJS for? If you only need to serve your static files, you may as well use BaseX to serve static contents and put all (e.g. symlink) Angular related stuff to your `webapp/static`-folder. The documentation is here: http://docs.basex.org/wiki/Web_Application#Available_Services <http://docs.basex.org/wiki/Web_Application#Available_Services> An example can be found here (https://github.com/BaseXdb/basex/tree/master/basex-api/src/main/webapp <https://github.com/BaseXdb/basex/tree/master/basex-api/src/main/webapp>) , there is a static folder that will be mapped to localhost:8984/restxq/static If by any means you need the NodeJS Server next to RestXQ a possible solution might be proxying the requests from NodeJS to your BaseX instance; so from the Browsers perspective all requests are sent to localhost:3000 :-) I used https://www.npmjs.com/package/express-http-proxy <https://www.npmjs.com/package/express-http-proxy> to redirect all request to http://localhost:3000 <http://localhost:3000/>/restxq -> http://localhost:8989/restxq/ <http://localhost:8989/restxq/> If you can not modify your NodeJS-service you might have a look at https://github.com/gr2m/CORS-Proxy: <https://github.com/gr2m/CORS-Proxy:> it provides out-of-the-box CORS headers for arbitrary URLs Lots of options for these OPTIONS headers ;-) Hope this helps a bit. Best from Konstanz Michael P.S. in production it’s usually beneficial to have only a single web-server face the world > Am 25.02.2017 um 09:34 schrieb Rob Stapper <r.stap...@lijbrandt.nl>: > > Hi Christian, > > I’m trying to build a web based frontend with Angular(2) with Basex as > backend. > Since Angular uses localhost:3000 and basex uses localhost:8984 I need CORS > to be activated in the bachend’s jetty-service. > If I try to activate this by editing the web.xml file I get the message from > the jetty that this service is not available. > Obviously version 8 of jetty does not support CORS. According to the > documentation Jetty 9 should support CORS. > > Is replacing jett 8 with version 9 somewere on the agenda? Or can I do this > myself? (new area for me) > I wouldn’t mind testrunning it. > > TIA, > Rob Stapper > > PS. I see the request the request being handled and send back by the backend > (basex) but it misses the necessary header. Debugging my Angular app in the > browser say that CORS-header is missing.