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 missing 'store' 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;
            }
            // Delete the store if an address was not specified in the request body.
            if ((req.body.address == null) || !req.body.address) {
                console.log("deleting in-memory data store '" + req.body.store + "'.");
                delete onmStoreDictionary[req.body.store];
                res.send(204);
                return;
            }
            // Attempt to delete the specified data component.
            var addressHash = req.body.address
            var address = undefined
            try {
                address = store.model.createAddressFromHashString(addressHash);
            } catch (exception) {
                console.error(exception);
                res.send(403, "Invalid address '" + req.body.address + "' is outside of the data model's address space.");
                return;
            }
            try {
                store.removeComponent(address);
                console.log("removed data component '" + addressHash + "' from in-memory store '" + req.body.store + "'.");
                res.send(204);
            } catch (exception) {
                res.send(412, exception);
            }
        }
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 missing 'store' 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;
            }
            // Delete the store if an address was not specified in the request body.
            if ((req.body.address == null) || !req.body.address) {
                console.log("deleting in-memory data store '" + req.body.store + "'.");
                delete onmStoreDictionary[req.body.store];
                res.send(204);
                return;
            }
            // Attempt to delete the specified data component.
            var addressHash = req.body.address
            var address = undefined
            try {
                address = store.model.createAddressFromHashString(addressHash);
            } catch (exception) {
                console.error(exception);
                res.send(403, "Invalid address '" + req.body.address + "' is outside of the data model's address space.");
                return;
            }
            try {
                store.removeComponent(address);
                console.log("removed data component '" + addressHash + "' from in-memory store '" + req.body.store + "'.");
                res.send(204);
            } catch (exception) {
                res.send(412, exception);
            }
        }
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 missing 'store' 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 ; } // Delete the store if an address was not specified in the request body. if ( ( req . body . address == null ) || ! req . body . address ) { console . log ( "deleting in-memory data store '" + req . body . store + "'." ) ; delete onmStoreDictionary [ req . body . store ] ; res . send ( 204 ) ; return ; } // Attempt to delete the specified data component. var addressHash = req . body . address var address = undefined try { address = store . model . createAddressFromHashString ( addressHash ) ; } catch ( exception ) { console . error ( exception ) ; res . send ( 403 , "Invalid address '" + req . body . address + "' is outside of the data model's address space." ) ; return ; } try { store . removeComponent ( address ) ; console . log ( "removed data component '" + addressHash + "' from in-memory store '" + req . body . store + "'." ) ; res . send ( 204 ) ; } catch ( exception ) { res . send ( 412 , exception ) ; } }
Delete the named onm data store. Or, if an address is specified delete the addressed data component in the given store instead.
Delete the named onm data store . Or if an address is specified delete the addressed data component in the given store instead .