Server-side JavaScript

HTTP Module

MarkLogic provides built-in functions for HTTP client and server functionality.

HTTP Server Functions

You can build custom server endpoints for a MarkLogic HTTP application server. Save the following code as "/search.sjs" in the modules database associated with your application server. Assuming you set up the application server on port 8050, send a GET request to http://localhost:8050/search.sjs?q=craft. Assuming you have data in your content database that matches the "craft" query, you will see some results.

See the AppServer function documentation for more examples of what you can do.

HTTP Client Functions

MarkLogic modules can also act as clients to other HTTP services. MarkLogic provides provides built-in functions for GET, POST, PUT, HEAD, DELETE, and OPTIONS requests.

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.