nexusdocs-server
v0.3.6-alpha.1
Published
NexusHubs server, a storage engine proxy for multi provider
Downloads
29
Readme
nexusdocs-server
NexusDocs server application
User Documentation
Install
Install as npm package:
npm install nexushubs-server
Install from source code:
git clone https://github.com/nexushubs/nexusdocs.git
cd packages/nexusdocs-server
npm install
Install default data:
./ndstool install
Creating connection URI for client
./ndstool client create-url user
Quick Start
Standalone Service
npm start
Start in Main Application
const createServer = require('nexusdocs-server');
const server = createServer({
hostname: '<hostname>', // default 127.0.0.1
port: '<port>', // default 4000
database: '<mongo-url>', // default mongodb://127.0.0.1/nexusdocs
});
server.start();
Behind nginx
server {
listen 80;
server_name storage.example.com;
#...
location /api/nexusdocs {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Original-URI $request_uri;
proxy_pass http://127.0.0.1:4000/api;
proxy_http_version 1.1;
}
#...
}
Config by Environment Variables
| Env | Description |
| --- | ----------- |
| NDS_DATABASE
| Mongodb database URL |
| NDS_RESTFUL_ENABLED
| Whether to start API Server |
| NDS_RESTFUL_HOSTNAME
| API Server bind hostname |
| NDS_RESTFUL_PORT
| API Server bind port |
| NDS_RESTFUL_TRUSTED_PROXY
| Trusted Proxy, see http://expressjs.com/en/4x/api.html#trust.proxy.options.table |
| NDS_RESTFUL_SERVER_URL
| Custom server url, default to '' |
| NDS_DEBUG_REQUEST
| Switch whether to debug HTTP requests |
Command Line Tool
$ ./ndstool --help
Usage: ndstool [options] [command]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
install install default data
env manage .env config
provider [command] manage provider
namespace [command] namespace provider
client [command] client manage
help [cmd] display help for [cmd]
Playing with Docker
The build-in docker-compose.yml starts 3 containers:
unoconv
for converting office documentmongo
build-in mongodb server, you can replace to your ownnds
NexusDocs server, with full run-time code
Start Server
$ docker-compose up -d
Creating nexusdocsserver_unoconv_1 ... done
Creating nexusdocsserver_mongo_1 ... done
Creating nexusdocsserver_nds_1 ... done
Install the Default Data
$ docker-compose exec nds /bin/sh
/usr/src/app # ndstool install
Checking Server Logs
$ docker-compose logs --follow nds
License
MIT