# NodeJS

# Inleiding

In dit voorbeeld wordt er een module ontwikkeld die de systeemtijd in het platform beschikbaar maakt.

# Module invulling

%%{init: {'theme':'base'}}%%
graph LR
    subgraph module
        TIME("time") --> INDEX("0")
        INDEX("0") --> DATA("epoch")
        DATA --> DATA_TYPE(type)
        DATA_TYPE --> DATA_TYPE_VAL("[number]")
        DATA --> DATA_DESCR("description")
        DATA_DESCR --> DATA_DESCR_VAL("tijd in millisecond sinds 1970-01-01T00:00:00Z")
        
        style DATA_TYPE_VAL fill:#DAE8FC,stroke-width:0px
        style DATA_DESCR_VAL fill:#DAE8FC,stroke-width:0px
    end
    subgraph discovery
        DISCOVERY("discover") --> SERVICE("epoch-service")
        SERVICE --> ONLINE("online") --> ONLINE_VAL(true)
        ONLINE --> ONLINE_TYPE("type") --> ONLINE_TYPE_VAL(boolean)
        ONLINE --> ONLINE_DESC("description") --> ONLINE_DESC_VAL("module nog steeds online")
        
        style ONLINE_VAL fill:#DAE8FC,stroke-width:0px
        style ONLINE_TYPE_VAL fill:#DAE8FC,stroke-width:0px
        style ONLINE_DESC_VAL fill:#DAE8FC,stroke-width:0px
        
        SERVICE --> ENABLED("enabled") --> ENABLED_VAL("true")
        ENABLED --> ENABLED_TYPE("type") --> ENABLED_TYPE_VAL(boolean)
        ENABLED --> ENABLED_DESC("description") --> ENABLED_DESC_VAL("module enabled")
        
        style ENABLED_VAL fill:#DAE8FC,stroke-width:0px
        style ENABLED_TYPE_VAL fill:#DAE8FC,stroke-width:0px
        style ENABLED_DESC_VAL fill:#DAE8FC,stroke-width:0px   
        
        SERVICE --> VERSION("version") --> VERSION_VAL("1")
        VERSION --> VERSION_TYPE("type") --> VERSION_TYPE_VAL(number)
        VERSION --> VERSION_DESC("description") --> VERSION_DESC_VAL("module versie nummer")
        
        style VERSION_VAL fill:#DAE8FC,stroke-width:0px
        style VERSION_TYPE_VAL fill:#DAE8FC,stroke-width:0px
        style VERSION_DESC_VAL fill:#DAE8FC,stroke-width:0px        
        
        SERVICE --> TIMESTAMP("timestamp") --> TIMESTAMP_VAL("[timestamp]")
        TIMESTAMP --> TIMESTAMP_TYPE("type") --> TIMESTAMP_TYPE_VAL(number)
        TIMESTAMP --> TIMESTAMP_DESC("description") --> TIMESTAMP_DESC_VAL("tijd sinds laatste update")
        
        style TIMESTAMP_VAL fill:#DAE8FC,stroke-width:0px
        style TIMESTAMP_TYPE_VAL fill:#DAE8FC,stroke-width:0px
        style TIMESTAMP_DESC_VAL fill:#DAE8FC,stroke-width:0px        
        
        SERVICE --> PATH("~") --> PATH_VAL("[SYS_PATH]/modules/time/0")
        PATH --> PATH_TYPE("type") --> PATH_TYPE_VAL(number)
        PATH --> PATH_DESC("description") --> PATH_DESC_VAL("pad waar de module zijn data publiceert")
        
        style PATH_VAL fill:#DAE8FC,stroke-width:0px
        style PATH_TYPE_VAL fill:#DAE8FC,stroke-width:0px
        style PATH_DESC_VAL fill:#DAE8FC,stroke-width:0px
    end