Home

Awesome

TerriaJS-Server

Greenkeeper badge

Build Status


We have just released a brand new version of Terria — verson 8!

We've put together a list of things we've removed from version 8 and some steps to help you migrate to the new version in our migration guide

Not ready to move to version 8 yet? You can find terriajs version 7 here: https://github.com/TerriaJS/terriajs/tree/terriajs7


This is a basic NodeJS Express server that serves up a (not included) static TerriaJS-based site (such as National Map) with a few additional useful services:

Generally, you don't want to manually install TerriaJS-Server. It comes installed with TerriaMap (see below).

Stand-alone installation (without serving TerriaMap)

Install

  1. git clone https://github.com/terriajs/terriajs-server
  2. cd terriajs-server
  3. npm install

Configure

Copy serverconfig.json.example to serverconfig.json and configure as needed. See comments inside that file. (Comments are allowed; see json5.org).

If you want to proxy authenticated layers, do the same for proxyauth.json.example.

Run

  1. npm start -- [options] [path/to/wwwroot]
terriajs-server.js [options] [path/to/wwwroot]

Options:
  --help, -h     Show this help.                                       [boolean]
  --version      Show version number                                   [boolean]
  --port         Port to listen on.                [default: 3001]      [number]
  --public       Run a public server that listens on all interfaces.
                                                       [boolean] [default: true]
  --config-file  File containing settings such as allowed domains to proxy. See
                 serverconfig.json.example
  --proxy-auth   File containing auth information for proxied domains. See
                 proxyauth.json.example
  --verbose      Produce more output and logging.     [boolean] [default: false]

For example, to run with port 3009:

npm start -- --port 3009

To run the server in the foreground, you can do this:

node . [arguments as above]

Tests

  1. Run npm test

Installation with TerriaMap

Just install TerriaMap. TerriaJS-Server is installed to node_modules/terriajs-server, and you can run it manually as node_modules/terriajs-server ./wwwroot.