Search code examples
node.jsangulargulpmarklogic

Connect to specific MarkLogic database via node slushjs


I'm using the slushjs generator for MarkLogic projects with node.

Rather than connecting to a new database that the slush generates, I'd like to connect to the existing, default Documents database.

Server Name: App-Services

Database: Documents

Port: 8000

Does anyone know which files I need to edit do such a connection? I've tried editing multiple files such as the deploy/build.properties, deploy/default.properties, deploy/local.properties, gulp file, etc.

But I've had no luck.


Solution

  • There are two config files relevant here:

    1. {env}.json
    2. deploy\{env}.properties

    where {env} can be local, dev, or prod.

    The first configures the NodeJS middle-tier that proxies calls from front-end to MarkLogic, next to serving statics, and handling authentication sessions. You'll be looking for the ml-http-port setting inside there.

    The second is used by the Roxy-deployer that comes with slush-marklogic-node. It is mainly used to create app-specific databases, and servers (good for code and content isolation), setup security (if needed), and deploy things like REST-api configuration, extensions, and transforms. In there you'd be looking for the app-port property, but setting that to 8000 will do you no good. Roxy will attempt to create an app-specific server on that port, but that is occupied by MarkLogic itself.

    You probably want to either:

    • ignore app-specific MarkLogic configuration, and only edit {env}.json, and ignore deploy/ altogether
    • or point your app-specific configuration towards the already existing Documents database, basically by changing the content-db property to Documents. Roxy will adjust indexes and settings of that database though, unless you take further action.

    HTH!