<commit_before>express = require "express"
Auth    = require "./app/auth"
User    = require "./app/storage"
Q       = require "q"
Mail    = require "./app/mail"
TodoTxt = require "./app/todo.txt"
TodoHtml = require "./app/todo.html"

port = 8080

app = express()

# Serve up static files in the public folder
app.configure ->
  # app.use express.static('/var/www/html/nitro/public')
  app.use express.bodyParser()

  # Allow CORS
  app.all "/*", (req, res, next) ->
    res.header "Access-Control-Allow-Origin", "*"
    res.header "Access-Control-Allow-Headers", "X-Requested-With"
    next()

global.DebugMode = DebugMode = off
app.__debug = ->
  process.env.NODE_ENV = "development"
  global.DebugMode = DebugMode = on
  console.warn "\u001b[31mRunning in debug mode!\u001b[0m"

# Enable debug mode if passed as argument
if "--debug" in process.argv then app.__debug()

# Redirect requests to beta.nitrotasks.com
app.get "/", (req, res) ->
  res.redirect('http://beta.nitrotasks.com')

# GET and POST requests
api =

  # ------------------
  # PayPal integration
  # ------------------

  "post_pro": (req, res) ->
    uid = req.body.uid
    code = req.body.code
    console.log uid, code

    Users.get(uid)
      .then (user) -><commit_msg>Change it to GET because POST is too hard to debug<commit_after>express = require "express"
Auth    = require "./app/auth"
User    = require "./app/storage"
Q       = require "q"
Mail    = require "./app/mail"
TodoTxt = require "./app/todo.txt"
TodoHtml = require "./app/todo.html"

port = 8080

app = express()

# Serve up static files in the public folder
app.configure ->
  # app.use express.static('/var/www/html/nitro/public')
  app.use express.bodyParser()

  # Allow CORS
  app.all "/*", (req, res, next) ->
    res.header "Access-Control-Allow-Origin", "*"
    res.header "Access-Control-Allow-Headers", "X-Requested-With"
    next()

global.DebugMode = DebugMode = off
app.__debug = ->
  process.env.NODE_ENV = "development"
  global.DebugMode = DebugMode = on
  console.warn "\u001b[31mRunning in debug mode!\u001b[0m"

# Enable debug mode if passed as argument
if "--debug" in process.argv then app.__debug()

# Redirect requests to beta.nitrotasks.com
app.get "/", (req, res) ->
  res.redirect('http://beta.nitrotasks.com')

# GET and POST requests
api =

  # ------------------
  # PayPal integration
  # ------------------

  "get_pro": (req, res) ->
    uid = req.param("uid")
    # code = req.body.code
    console.log uid

    Users.get(uid)
      .then (user) ->
{'fraction_non_alphanumeric': 0.17630744849445326, 'fraction_numerical': 0.010301109350237718, 'mean_word_length': 2.713235294117647, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6974241', 'n_tokens_mistral': 874, 'n_tokens_neox': 836, 'n_words': 219}