Skip to content

appmodule/StudentProject2018_Backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSIOT Backend (Summer internship 2018 - AppModule)

SSIOT Backend is an application which supports SSIOT Frontend application and SSIOT iOS application. It is written in javascript (node.js) and express framework. Data storage is done in MongoDB noSQL database.

References

Functionality

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development.

Installation

SSIOT Backend requires:

Install the dependencies and devDependencies and start the server.

$ npm install
$ npm start
// Starting on port 3000

Optionally instead npm start use npm run watch if you want to build on every change .

$ npm run watch

Edit env.json file to setup enviroment variables.

    {
    "app": {
        "port": PORT
    },
    "mqtt": {
        "host": MQTT-BROKER,
        "port": MQTT-BROKER-PORT
    },
    "mongodb": {
        "host": MONGO-DB-HOST,
        "db": DB-NAME
    }
}

Restful API

List of API calls:

Layout:

Save layout

POST [server]/layout/save

    input: {
        widgets: Object
        name: String
    }
    output: {
        message: "Saved successfully: [layout.name]"
    }
Load layout

POST [server]/layout/load

    input: {
        name: String    //  Layout name
    }
    output: {
        Layout: Object
    }
Load sensors

Sensor:

POST [server]/sensor/load

    output: {
        Sensors: Object //  All sensors 
    }
Sensor manifest

Ssiot:

POST [server]/ssiot/mnf/:guid/:sensorid

    input:
        :guid
        :sensorid
    {
        format: Object
    }    
    output: {
        message: "Sensor manifested successfully: [sensor]!" // if doesn't already exist
        ||
     message: "Sensor updated successfully: [sensor]!" // if doesn't already exist   
    }

User:

Create user

POST [server]/user/create

    input: {
        username: String,
        password: String
    }
    output: {
        message: "Succesufully created [username]!"
    }
User login

POST [server]/user/login

    input: {
        username: String,
        password: String
    }
    output: {
        message: "Successfully logged in!"
    }
User logout

POST [server]/user/logout

    output: {
        message: "Successfully logged out!"
    }

Widget:

Save widget

POST [server]/widget/save

    input: {
        name: String,
        design: String,
        functions: Object,
        scheme: Object,
        format: Object,
        coords: Ovject
    }
    output: {
        message: "Widget [widget.name] successfully saved!"
    }
Load widget

POST [server]/widget/load

    output: {
        widgets: [Objects]
    }
Delete widget (first way)

POST [server]/widget/:id/delete

    input:
        :id
    output: {
        message: "Successfully deleted!"
    }
Delete widget (second way)

POST [server]/widget/delete

    input: {
        _id: String
    }
    output: {
        message: "Successfully deleted!"
    }

POST [server]/widget/deleteall

    output: {
        message: "All widgets successufully deleted!"
    }

Built With

  • Node.js - Javascript server environment
  • npm - Dependency Management
  • express - Web framework for Node.js

Dependencies

devDependencies

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published