sling-server
v0.1.2
Published
Implements a RESTful server that is API-compatible with Apache Sling
Downloads
2
Keywords
Readme
Entropy sling-server
The Entropy sling-server
is a web server that provides a RESTful API which is largely compatible with Apache Sling. Unlike Apache's version, this server is implemented in Node.js; it is not backed by the JVM, OSGI, or any kind of Java Content Repository. For storage, it writes directly to JSON files on the filesystem, in a format which is very similar to what is described in the VaultFS specification, but using JSON in place of XML. For version control and replication, Git can be applied against the JSON files on the filesystem.
Installation
You can install sling-server
as follows:
> npm install -g sling-server
Usage
Once installed, you can start up the sling-server
as follows:
> sling-server /path/to/json-content
By default the service listens on port 4500, but this can be changed with the -p
command line parameter .
Initializing content
There are several different ways to initialize content for your sling-server
, including:
- Start issuing HTTP
POST
commands using the Sling protocol. - Use a Sling content initialization tool, such as
sling-server --init
- Download a
.zip
content package from another Sling instance. Unzip the package, and convert it to .json format using thesling-packager
command line tool, available via NPM.
Example initialization using curl
The following command will create a two useful base folders at the path /content/my-site
:
curl --request POST http://127.0.0.1:4500/content/my-site --data "../jcr:primaryType=nt:folder" --data "jcr:primaryType=nt:folder" --data "jcr:content/jcr:primaryType=nt:unstructured" --data "jcr:content/sling:resourceType=blacklight/edit/page/new"