routes.js
function(req, res) {
            if (!req._body || (req.body == null) || !req.body) {
                res.send(400, "Invalid POST missing required request body.");
                return;
            }
            if ((req.body.store == null) || !req.body.store) {
                res.send(400, "Invalid POST mising 'store' property in request body.");
                return;
            }
            if ((req.body.address == null) || !req.body.address) {
                res.send(400, "Invalid POST missing 'address' property in request body.");
                return;
            }
            if ((req.body.data == null) || !req.body.data) {
                res.send(400, "Invalid POST missing 'data' property in request body.");
                return;
            }
            var store = onmStoreDictionary[req.body.store];
            if ((store == null) || !store) {
                res.send(404, "The specified onm data store '" + req.body.store + "' does not exist on this server.");
                return;
            }
            var address = undefined;
            try {
                address = store.model.createAddressFromHashString(req.body.address);
            } catch (exception) {
                console.error(exception);
                res.send(403, "Invalid address '" + req.body.address + "' is outside of the data model's address space.");
                return;
            }
            var namespace = undefined
            try {
                namespace = store.openNamespace(address);
            } catch (exception) {
                console.error(exception);
                res.send(404, "Data component '" + req.body.address + "' does not exist in store '" + req.body.store + "'.");
                return;
            }
            try {
                namespace.fromJSON(req.body.data);
            } catch (exception) {
                console.error(exception);
                res.send(400, "Unable to de-serialize JSON data in request.");
                return;
            }
            res.send(204);
        }
function(req, res) {
            if (!req._body || (req.body == null) || !req.body) {
                res.send(400, "Invalid POST missing required request body.");
                return;
            }
            if ((req.body.store == null) || !req.body.store) {
                res.send(400, "Invalid POST mising 'store' property in request body.");
                return;
            }
            if ((req.body.address == null) || !req.body.address) {
                res.send(400, "Invalid POST missing 'address' property in request body.");
                return;
            }
            if ((req.body.data == null) || !req.body.data) {
                res.send(400, "Invalid POST missing 'data' property in request body.");
                return;
            }
            var store = onmStoreDictionary[req.body.store];
            if ((store == null) || !store) {
                res.send(404, "The specified onm data store '" + req.body.store + "' does not exist on this server.");
                return;
            }
            var address = undefined;
            try {
                address = store.model.createAddressFromHashString(req.body.address);
            } catch (exception) {
                console.error(exception);
                res.send(403, "Invalid address '" + req.body.address + "' is outside of the data model's address space.");
                return;
            }
            var namespace = undefined
            try {
                namespace = store.openNamespace(address);
            } catch (exception) {
                console.error(exception);
                res.send(404, "Data component '" + req.body.address + "' does not exist in store '" + req.body.store + "'.");
                return;
            }
            try {
                namespace.fromJSON(req.body.data);
            } catch (exception) {
                console.error(exception);
                res.send(400, "Unable to de-serialize JSON data in request.");
                return;
            }
            res.send(204);
        }
function ( req , res ) { if ( ! req . _body || ( req . body == null ) || ! req . body ) { res . send ( 400 , "Invalid POST missing required request body." ) ; return ; } if ( ( req . body . store == null ) || ! req . body . store ) { res . send ( 400 , "Invalid POST mising 'store' property in request body." ) ; return ; } if ( ( req . body . address == null ) || ! req . body . address ) { res . send ( 400 , "Invalid POST missing 'address' property in request body." ) ; return ; } if ( ( req . body . data == null ) || ! req . body . data ) { res . send ( 400 , "Invalid POST missing 'data' property in request body." ) ; return ; } var store = onmStoreDictionary [ req . body . store ] ; if ( ( store == null ) || ! store ) { res . send ( 404 , "The specified onm data store '" + req . body . store + "' does not exist on this server." ) ; return ; } var address = undefined ; try { address = store . model . createAddressFromHashString ( req . body . address ) ; } catch ( exception ) { console . error ( exception ) ; res . send ( 403 , "Invalid address '" + req . body . address + "' is outside of the data model's address space." ) ; return ; } var namespace = undefined try { namespace = store . openNamespace ( address ) ; } catch ( exception ) { console . error ( exception ) ; res . send ( 404 , "Data component '" + req . body . address + "' does not exist in store '" + req . body . store + "'." ) ; return ; } try { namespace . fromJSON ( req . body . data ) ; } catch ( exception ) { console . error ( exception ) ; res . send ( 400 , "Unable to de-serialize JSON data in request." ) ; return ; } res . send ( 204 ) ; }
Overwrite a specific data component in a specific store.
Overwrite a specific data component in a specific store .