With CoffeeScript I can extend node's http.Server class:
{Server} = require 'http'
class MyServer extends Server
  foo: 'bar'
myserver = new MyServer
console.log myserver.foo # 'bar'
class MyServer2 extends MyServer
  constructor: -> super()
myserver2 = new MyServer2
myserver.listen 3000
If I have correctly understood this post, express extends connect which in turn extends http.Server. But the following have some inheritance problems:
Express = require 'express'
class MyApp extends Express
  foo: 'bar'
myapp = new MyApp
console.log myapp.foo # undefined
class MyApp2 extends MyApp
  constructor: -> super()
myapp2 = new MyApp2
console.log myapp2 # {}
myapp2.listen 3000 # throws TypeError
When listen is called it throws the following error because myapp2 is an empty object {} and doesn't have the listen method:
TypeError: Object #<MyApp2> has no method 'listen'
How can I use express in an Object Oriented Way with CoffeeScript?
 
     
     
    