Skip to content

Latest commit

 

History

History
358 lines (187 loc) · 10.2 KB

README.md

File metadata and controls

358 lines (187 loc) · 10.2 KB

This project requires JVM version of at least 1.7

routemaster top

lightweight web server with RESTful routing

Table of Contents top

RouteMaster

Handy routing controller for the truly excellent nanohttpd tiny, easily embeddable HTTP Java server.

See https://synapticloop.github.io/routemaster/ for full documentation

routemaster home page

Templating with Templar templating language top

Yes, you can now do some server side includes, using the synapticloop templar templating language!

A quick example is:

{import src/main/html/templar-handler.snippet}

Module support top

To make it quicker and easier to get started with routemaster, we added in module functionality so that it can be easily extended.

Instructions:

Download the routemaster-<version>-server.jar from the github releases directory (which contains all of the dependencies that are required), download modules that you require and place them in the modules directory from where you launched the routemaster server.

These will be automatically registered and ready to go.

For an example module with everything you need to build and deploy, see https://github.com/synapticloop/routemaster-module-example.

Some of the available modules

Thumbnailer routemaster-module-thumbnailer automatically generate thumbnails of images on the fly.

Templar Handler routemaster-module-templar-handler add templar templating language handling to the routemaster server.

Static file lister routemaster-module-static-file-lister add in static file listing and navigation.

Options top

Following the NanoHTTPD, you may pass in the following options

- h      
--host   The host to bind to - default 127.0.0.1

-p
--port   The port to bind to - default 5474

-d
--dir    The directory that the html files reside in

As an aside top

The name RouteMaster pays homage to the original London buses (see the wikipedia entry) which would take you wherever you would like to go.

The favicon is also related, showing a depiction of the back top window of a routemaster bus.

Building the Package

*NIX/Mac OS X

From the root of the project, simply run

./gradlew build

Windows

./gradlew.bat build

This will compile and assemble the artefacts into the build/libs/ directory.

Note that this may also run tests (if applicable see the Testing notes)

Running the Tests

*NIX/Mac OS X

From the root of the project, simply run

gradle --info test

if you do not have gradle installed, try:

gradlew --info test

Windows

From the root of the project, simply run

gradle --info test

if you do not have gradle installed, try:

./gradlew.bat --info test

The --info switch will also output logging for the tests

Artefact Publishing - Github

This project publishes artefacts to GitHub

Note that the latest version can be found https://github.com/synapticloop/routemaster/releases

As such, this is not a repository, but a location to download files from.

Artefact Publishing - Bintray

This project publishes artefacts to bintray

Note that the latest version can be found https://bintray.com/synapticloop/maven/routemaster/view

maven setup

this comes from the jcenter bintray, to set up your repository:



<?xml version="1.0" encoding="UTF-8" ?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd' xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>bintray</name>
          <url>http://jcenter.bintray.com</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>bintray-plugins</name>
          <url>http://jcenter.bintray.com</url>
        </pluginRepository>
      </pluginRepositories>
      <id>bintray</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>bintray</activeProfile>
  </activeProfiles>
</settings>


gradle setup

Repository



repositories {
	maven {
		url  "http://jcenter.bintray.com" 
	}
}


or just



repositories {
	jcenter()
}


Dependencies - Gradle



dependencies {
	runtime(group: 'synapticloop', name: 'routemaster', version: '2.3.0', ext: 'jar')

	compile(group: 'synapticloop', name: 'routemaster', version: '2.3.0', ext: 'jar')
}


or, more simply for versions of gradle greater than 2.1



dependencies {
	runtime 'synapticloop:routemaster:2.3.0'

	compile 'synapticloop:routemaster:2.3.0'
}


Dependencies - Maven



<dependency>
	<groupId>synapticloop</groupId>
	<artifactId>routemaster</artifactId>
	<version>2.3.0</version>
	<type>jar</type>
</dependency>


Dependencies - Downloads

You will also need to download the following dependencies:

cobertura dependencies

  • net.sourceforge.cobertura:cobertura:2.0.3: (It may be available on one of: bintray mvn central)

compile dependencies

runtime dependencies

server dependencies

testCompile dependencies

NOTE: You may need to download any dependencies of the above dependencies in turn (i.e. the transitive dependencies)

License



The MIT License (MIT)

Copyright (c) 2017 synapticloop

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.