<commit_before>express               = require 'express'
morgan                = require 'morgan'
body_parser           = require 'body-parser'
errorhandler          = require 'errorhandler'
http                  = require 'http'
path                  = require 'path'
orm                   = require 'orm'
cookies               = require 'cookies'
Account               = require './models/account'
AccountsController    = require './controllers/accounts_controller'
AccountsApiController = require './controllers/api/v1/accounts_controller'

# console.log "ENV", JSON.stringify(process.env, null, 2)
global.RDIO_TOKEN = [process.env.RDIO_KEY, process.env.RDIO_SECRET]
console.log "using RDIO_TOKEN:", JSON.stringify(global.RDIO_TOKEN)

app = express()

app.use morgan(format: 'dev')
app.use body_parser()
app.use express.static path.join(__dirname, '../public')
app.use cookies.express 'rdio_key'

# development only
app.use errorhandler() if 'development' == app.get('env')

orm.connect "mysql://root:@localhost/rdio_sync", (err, database) ->
  throw err if err?
  AccountTable = database.define 'accounts', Account.schema

  database.sync (error) ->
    server = http.Server(app)

    # Instantiate controllers
    accounts_controller     = new AccountsController account_table: AccountTable
    accounts_api_controller = new AccountsApiController account_table: AccountTable

    # Register URLs
    app.get  '/', (request, response) ->
      response.sendfile path.join(__dirname, '../public/index.html')

    app.post '/accounts', accounts_controller.create
    app.get  '/accounts/:account_id/login', accounts_controller.login

    app.get  '/api/v1/account', accounts_api_controller.show
    app.put  '/api/v1/account', accounts_api_controller.update

    app.use (req, res) ->
      return res.send 404 unless req.method == 'GET'
      res.sendfile path.join(__dirname, '../public/index.html')

    port = process.env.PORT ? 3004
    server.listen port, ->
      console.log "Express server listening on port #{server.address().port}"<commit_msg>Don't serve up static files<commit_after>express               = require 'express'
morgan                = require 'morgan'
body_parser           = require 'body-parser'
errorhandler          = require 'errorhandler'
http                  = require 'http'
path                  = require 'path'
orm                   = require 'orm'
cookies               = require 'cookies'
Account               = require './models/account'
AccountsController    = require './controllers/accounts_controller'
AccountsApiController = require './controllers/api/v1/accounts_controller'

# console.log "ENV", JSON.stringify(process.env, null, 2)
global.RDIO_TOKEN = [process.env.RDIO_KEY, process.env.RDIO_SECRET]
console.log "using RDIO_TOKEN:", JSON.stringify(global.RDIO_TOKEN)

app = express()

app.use morgan(format: 'dev')
app.use body_parser()
app.use express.static path.join(__dirname, '../public')
app.use cookies.express 'rdio_key'

# development only
app.use errorhandler() if 'development' == app.get('env')

orm.connect "mysql://root:@localhost/rdio_sync", (err, database) ->
  throw err if err?
  AccountTable = database.define 'accounts', Account.schema

  database.sync (error) ->
    server = http.Server(app)

    # Instantiate controllers
    accounts_controller     = new AccountsController account_table: AccountTable
    accounts_api_controller = new AccountsApiController account_table: AccountTable

    # Register URLs
    app.get  '/', (request, response) -> response.send status: 'online'

    app.post '/accounts', accounts_controller.create
    app.get  '/accounts/:account_id/login', accounts_controller.login

    app.get  '/api/v1/account', accounts_api_controller.show
    app.put  '/api/v1/account', accounts_api_controller.update

    port = process.env.PORT ? 3004
    server.listen port, ->
      console.log "Express server listening on port #{server.address().port}"
{'fraction_non_alphanumeric': 0.1184077079107505, 'fraction_numerical': 0.004817444219066937, 'mean_word_length': 3.2192513368983957, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3912393', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1129, 'n_words': 267}