Giter Club home page Giter Club logo

terriajs-server's Introduction

TerriaJS-Server

Greenkeeper badge

Build Status

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:

  • /api/v1/proxy: a proxy service which applies CORS headers for data providers that lack them. Add URLs to config.json to enable them.
  • /api/v1/proj4def: a proj4 coordinate reference system lookup service.
  • /api/v1/convert: an ogr2ogr server-side conversion service.
  • /api/v1/proxyabledomains: return a JSON of domains the server is willing to proxy for
  • /api/v1/ping: returns 200 OK.
  • /api/v1/share/X-Y (GET): uses prefix X to resolve key Y against some configured JSON storage provider (Gist and Google URL Shortener implemented)
  • /api/v1/share (POST): stores a piece of JSON with a configured storage provider (Gist implemented)
  • /api/v1/serverconfig: retrieve (safe) information about how the server is configured.
  • All other requests are served from the wwwroot directory you provide on the command line, which defaults to ./wwwroot
  • If files [wwwroot]/404.html and/or [wwwroot]/500.html exist, they will be served for those HTTP error codes.
  • Supports very simple authentication via a single username/password included in requests using HTTP basic authentication.
  • Proxied services that require HTTP authentication can be proxied by adding credentials to a proxyauth.json file.
  • It can be run in HTTPS mode, although there are better ways of doing that in production.

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 2.6.0
node_modules/terriajs-server/lib/app.js [options] [path/to/wwwroot]

Options:
  --port         Port to listen on.                [default: 3001]
  --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                  [boolean] [default: false]
  --help, -h     Show this help.                                       [boolean]```

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](http://terria.io/Documentation). TerriaJS-Server is installed to `node_modules/terriajs-server`, and you can run it manually as `node_modules/terriajs-server ./wwwroot`.

terriajs-server's People

Contributors

a-stacey avatar alexgilleran avatar greenkeeper[bot] avatar greenkeeperio-bot avatar kring avatar meh9 avatar racingtadpole avatar stevage avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.