cyu
10/16/2012 - 5:55 AM

Example connect-emma server

Example connect-emma server

connect  = require 'connect'
emma     = require 'connect-emma'

emmaConfig =
  namespaces:
    deals: # deal pics optimized for mobile
      urlTemplate: 'http://cloud.scoutmob.com/upload/images/deals/$1/original.$extension'
      cacheExpiration: 14 * 24 * 60 * 60 # 14 days
      processImage: (gm) -> gm.quality(60)

port = 8080
app = connect()
  .use(connect.logger())
  .use(emma(emmaConfig))
  .use(connect.errorHandler())
  .listen(port)

console.log("Server started on port #{port}")
emmaConfig =
  namespaces:
    deals: # deal pics optimized for mobile
      urlTemplate: 'http://cloud.scoutmob.com/upload/images/deals/$1/original.$extension'
      cacheExpiration: 14 * 24 * 60 * 60 # 14 days
      processImage: (gm) -> gm.quality(60)