Skip to content

dos-group/expo-demo-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Expo Demo Server

This project creates an Express server on a virtual machine. The server accepts external GET and POST requests and reads and writes data to a Cassandra database. Cassandra tables are created by Express from the schemas provided in the models directory. This demo server only reads and writes data to the WGS_Measurements table in the WaterGridSense keyspace.

Requirements

VirutalBox and Vagrant must be installed.

Installation

Use the provided Vagrantfile to start a virtual machine with vagrant up

This will start Cassandra and an Express server reachable at 192.168.18.101:3000.

Usage

Once the virtual machine is running, external POST and GET requests can be made to 192.168.18.101:3000.

POST Requests

POST requests will write data to the WGS_Measurements Cassandra table. Data can be passed in the body of the request using the following parameters:

Parameter Type
uid uuid
type text
sensorid text
timestamp timestamp
location text
rawValue double
conValue double

If a parameter is empty or not passed, placeholder data will be created.

Example request:

curl -X POST '192.168.18.101:3000/' -d 'uid=6e6b22c1-f909-467c-a67a-117d08254450&type=sensor&sensorid=S-1234&location=Berlin&rawValue=1'

On successful requests the server will respond that [uid] has been saved to Cassandra.

GET Requests

GET requests read a uid passed as a query parameter and return the result. Example request:

curl -X GET '192.168.18.101:3000/?uid=6e6b22c1-f909-467c-a67a-117d08254450'

On successful requests, data corresponding to the uid will be returned from the WGS_Measurements table.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published