         userMobileNumber
         numberOfDigits
       }
-      res.send JSON.stringify {
+      res.send {
         success: true
-        userMobileNumber
-      }
-    catch err
-      logError err
-      res.status 500
-      res.send JSON.stringify {
-        success: false
-        err: "Server Error: #{ util.format err }"
-        userMobileNumber
-      }
-  .catch (err) ->
-    logError err
-    res.status 500
-    res.send JSON.stringify {
-      success: false
-      err: "Server Error: #{ util.format err }"
-    }
-
-app.all '/checkCode', (req, res) ->
-  co ->
-    res.type 'application/json'
-
-    {
-      userMobileNumber
-      developerEmail
-      code
-    } = req.query
-
-    ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress
-
-    badRequest = _badRequestFactory res
-
-    if _basicValidateRequest badRequest, req
-      return
-
-    unless code?
-      return badRequest "`code` must be provided"
-
-    try
-      validCode = yield checkCodeAsync {
-        developerEmail
-        code
-        userMobileNumber
-      }
-      validCode = !!validCode
-      res.send JSON.stringify {
-        success: true
-        validCode
         userMobileNumber
       }
     catch err

  badRequest = (message) ->
    console.log "Bad Request: #{ message }"
    res.status 400
    res.send JSON.stringify {
      success: false
      err: "Bad Request: #{ message }"
    }

  .catch (err) ->
    logError err
    res.status 500
    res.send {
      success: false
      err: "Server Error: #{ util.format err }"
    }

app.get '/status', (req, res) ->
  res.type 'application/json'
  res.send status: 'ok'

app.all '/checkCode', (req, res) ->
  co ->
    res.type 'application/json'

    {
      userMobileNumber
      developerEmail
      code
    } = req.query

    ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress

    badRequest = _badRequestFactory res

    if _basicValidateRequest badRequest, req
      return

    unless code?
      return badRequest "`code` must be provided"

    try
      validCode = yield checkCodeAsync {
        developerEmail
        code
        userMobileNumber
      }
      validCode = !!validCode
      res.send {
        success: true
        validCode
        userMobileNumber
      }
    catch err
      logError err
      res.status 500
      res.send {
        success: false
        err: "Server Error: #{ util.format err }"
        userMobileNumber
      }
  .catch (err) ->
    logError err
    res.status 500
    res.send {
      success: false
      err: "Server Error: #{ util.format err }"
    }


_badRequestFactory = (res) ->
  """Returns a function that sends bad request responses"""
