Giter Club home page Giter Club logo

layouts-simple-server's Introduction

DEPRECATED:

This example is deprecated in favor of a new Node.js Application and Layout Server Example.

Overview

Glue42 Desktop can store layouts locally or use a REST service as a store. This package contains a simple REST server that operates as a layouts store.

This basic implementation stores the user layouts in files (they have the same structure as the local layouts files) and returns the same set of data for all users (does not take the user into account). New layouts are stored in files (using the name of the layout - there is no validation whether the layouts name can be used as a filename). The remove layout operation is not implemented and just logs to the console.

Prerequisites

In order to run the layouts server, you need to install npm and Node v.10 (probably can run with a lower one as well).

Running the Layouts Server

Navigate to the server root directory and run from a command prompt:

npm i
npm run start

The layouts server will start to listen on port 8004 and will load layouts from the \layouts folder. The environment variable SERVER_PORT can be used to override the default port and the default layouts folder can be changed by setting the LAYOUTS_FOLDER variable.

Configuring Glue42 Desktop

If your Glue42 Desktop copy is not configured to load layouts from a REST service, you need to edit the system.json file located in the %LocalAppData%\Tick42\GlueDesktop\config folder.

  1. Locate the layouts top-level property:
 "layouts": {
    "store": {
        "type": "file"
    }
  }
  1. Update the layouts store to:
 "layouts": {
    "store": {
        "type": "rest",
        "restURL": "http://localhost:8004/",
        "restFetchInterval": 20
      }
  } 
  • type - can be file or rest, depending on the type of layouts store you want to setup;
  • restURL - the URL address of the layouts REST service;
  • restFetchInterval - interval (in seconds) for fetching layouts from the REST service;

REST

The REST service implements:

  • GET layouts - returns all layouts. In a real implementation this should consider the user that is passed in the request headers.
  • POST layouts - creates/updates a layout in this demo server;
  • DELETE layouts - removes a layout. Does nothing in this demo server, only logs to the console;

layouts-simple-server's People

Contributors

arjunah avatar kirilpopov avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.