Ta zawartość nie jest dostępna w wymaganym języku. Wersja w języku angielskim znajduje się tutaj.

Validate data


Updated: June 16, 2015

In a JavaScript backend mobile service, server scripts are used to enforce server-side validation rules. For example, the following insert script only allows the operation to succeed when the item being inserted has a numeric price property greater than zero. Otherwise, the script writes an error to the response by calling request.respond.

function insert(item, user, request) {
    if (typeof item.price === 'number' && item.price > 0) {
    } else {
        request.respond(statusCodes.BAD_REQUEST, 'Price must be a positive number');

For more information, see the Mobile Services script reference