Skip to content

Latest commit

 

History

History
75 lines (44 loc) · 2.1 KB

README.md

File metadata and controls

75 lines (44 loc) · 2.1 KB

sosmessage - API

Overview

The messages are stored in a mongoDB database.

The Web services used by the mobile applications are exposed through Unfiltered.

MongoDB

To install it on your system, see here.

Casbah

We are using the non released version 3.0.0-SNAPSHOT due to some bugs fixed in this version.

Before running the Administration or API app, you need to install on you local repository the 3.0.0-SNAPSHOT version of Casbah.

$ git clone git://github.com/mongodb/casbah.git
$ cd casbah
$ sbt publish-local

API

Install SBT

See the install instructions.

Launch the server

$ cd backend/sosmessage-api
$ sbt run

The SosMessage API will be accessible at http://localhost:3000/api/v1/....

  • http://localhost:3000/api/v1/categories: all categories;
  • http://localhost:3000/api/v1/category/{categoryId}/messages: all the messages of the given category;
  • http://localhost:3000/api/v1/category/{categoryId}/message: one random message of the given category.

Build a single executable JAR

$ cd backend/sosmessage-api
$ sbt one-jar

You can then launch the server with:

$ java -jar sosmessage-api_2.9.1-2.1-SNAPSHOT-one-jar.jar

Configuration

To change the default configuration, you can define your own configuration file through a system property:

$ java -Dsosmessage.configurationFile=conf/sosmessage.conf -jar sosmessage-api_2.9.1-2.1-SNAPSHOT-one-jar.jar

A configuration file looks like (those are the default values):

database {
  host = 127.0.0.1
  port = 27017
  name = sosmessage
}
server {
  port = 3000
}

Logging

Logging is done through Logback.

To override the default configuration, you can use the one in conf/ by specifying it as a system property:

$ java -Dlogback.configurationFile=conf/logback.xml -jar sosmessage-api_2.9.1-2.1-SNAPSHOT-one-jar.jar

See how to configure Logback here.