Using the BaseX REST interface from JavaScript
Hi,
I'm new at this, so please excuse if I missed something obvious...
BaseX implements a REST interface via basexhttp and JavaScript frameworks like Ext JS allow you to use a REST interface for accessing data. So I thought it may be possible to create a Web interface to a corpus stored in BaseX that enables users to search the corpus and update the annotations *without* writing server-side code.
The first obstacle I encountered is that under the same-orgin policy browsers consider localhost and localhost:8984 two separate domains and inhibit XmlHttpRequests calls, and basexhttp seems not to support cross-origin resource sharing (see <http://enable-cors.org/>).
Using BaseX as a data store for an Ext JS component without having to write server-side code seems very attractive. However, I'm now wondering whether this approach makes sense at all. Has anybody tried to do something like this?
Thanks in advance!
Best regards
Hi,
you should have a look at this basex sub-project: https://github.com/micheee/xquery-webapp-skeleton
Great stuff for developing web applications using XQuery - and you are free to define your own REST-style API.
Best Regards, Max
2011/12/17 Michael Piotrowski <mxp at cl.uzh.ch>
Quoted text · Michael Piotrowski · 35 lines
> Hi, > > I'm new at this, so please excuse if I missed something obvious... > > BaseX implements a REST interface via basexhttp and JavaScript > frameworks like Ext JS allow you to use a REST interface for accessing > data. So I thought it may be possible to create a Web interface to a > corpus stored in BaseX that enables users to search the corpus and > update the annotations *without* writing server-side code. > > The first obstacle I encountered is that under the same-orgin policy > browsers consider localhost and localhost:8984 two separate domains and > inhibit XmlHttpRequests calls, and basexhttp seems not to support > cross-origin resource sharing (see <http://enable-cors.org/>). > > Using BaseX as a data store for an Ext JS component without having to > write server-side code seems very attractive. However, I'm now > wondering whether this approach makes sense at all. Has anybody tried > to do something like this? > > Thanks in advance! > > Best regards > > -- > Dr.-Ing. Michael Piotrowski, M.A. <mxp at cl.uzh.ch> > Institute of Computational Linguistics, University of Zurich > Phone +41 44 63-54313 | OpenPGP public key ID 0x1614A044 > * OUT NOW: Systems and Frameworks for Computational Morphology > * <http://www.springeronline.com/978-3-642-23137-7> > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Max,
Quoted text · Maximilian Gärber · 6 lines
On 2011-12-17, Maximilian Gärber <mgaerber at arcor.de> wrote: > you should have a look at this basex sub-project: > https://github.com/micheee/xquery-webapp-skeleton > > Great stuff for developing web applications using XQuery - and you are free > to define your own REST-style API.
Thank you for the pointer. It's a bit different from what I was looking for, but nevertheless very interesting.
Thanks and best regards
Written for BaseX 7.0. BaseX may have changed since: please check the current documentation.