Skip to content

make the app mountable#345

Closed
guybrush wants to merge 4 commits intoether:masterfrom
guybrush:mountableApp
Closed

make the app mountable#345
guybrush wants to merge 4 commits intoether:masterfrom
guybrush:mountableApp

Conversation

@guybrush
Copy link
Copy Markdown
Contributor

this is not meant to be merged yet, it is an approach to make the etherpad-lite-app mountable into other express-apps.

right now it feels SUPER-hacky - but works

with the current patch, one can mount the etherpad like that:

var app = require('express').createServer()
var pad = require('etherpad-lite/node/server.js')
app.use('/pad', pad.helpExpress(
  { basepath : '/pad'
  , settings : 
    { dbType: 'dirty'
    , dbSettings: { filename: '/home/patrick/pad.db' }
    , defaultPadText : 'blub'
    , minify : true
    , abiword : null
    , loglevel: 'INFO'
    }
  }
))
app.listen(5000)
  • handling of settings is really bad right now :p
  • the basepath passed to the helpExpress must match the route where you mount the etherpad (/pad in my example)
  • i dont know what happens when the app which mounts the etherpad already uses socket.io

anyway - this is how i use etherpad-light right now, would love to hear what you are thinking about it

@guybrush
Copy link
Copy Markdown
Contributor Author

actually, i would like to make it like that:

var app = require('express').createServer()
var padSettings = 
  { dbType: 'dirty'
  , dbSettings: { filename: '/home/patrick/pad.db' }
  , defaultPadText : 'blub'
  , minify : true
  , abiword : null
  , loglevel: 'INFO'
  }
var pad = require('etherpad-lite')(padSettings)
app.use('/pad', pad.app)
app.listen(5000)
// also possible:
// pad.app.get('/otherRoute',function(req,res){res.end('hello')})
// pad.app.listen(5000)

how do you think about that api?

we could make all the routes editable in the settings

Comment thread static/pad.html
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep relative paths

@timeturner
Copy link
Copy Markdown

This is really interesting. I hope it gets done actually.

Basically for someone using express, and monogdb there has to be a system to replace etherpad-lite's database with redis or something and then periodically update a document in mongodb. That would be the most ideal and easiest way to integrate etherpad-lite. Otherwise it's very restrictive with little documentation on api to introduce it seamlessly into other apps.

@guybrush
Copy link
Copy Markdown
Contributor Author

@cweider sorry there is lots of noise in this patches, they are not meant to be merged - its all about the idea/api :D

@ronquil yes it would be cool to have an option to mount ep-lite into another app

i will try to make a better patch next weekend

thanks for response

@timeturner
Copy link
Copy Markdown

@guybrush if you can make ep-lite mountable with redis (realtime database) and some other persistant database (mongodb, postgresql) in express that would be amazing. I would do almost anything to push this approach. However I feel that it might involve a major rewrite of how ep-lite works as a standalone now. Anyways keep us posted on your progress! :D

@booo
Copy link
Copy Markdown
Contributor

booo commented Feb 1, 2012

  • There should be a settings object which one passes to the padApp
    • It should be possible to have multipe instance of an settings object
  • There should be a padApp which is an instance of an express server/app (express.createServer)
    • the app takes a settings instance as configuration parameter
    • (as second parameter one can add a database instance which the app should share with other apps)
    • the padApp should be mountable by express
    • think of it as a library
  • There should be another module which creates a standalone ep-lite instance
    • the module/server should understand some commandline options e.g. tell the server the place of the config file
  • don't keep states in modules
    • e.g the database instance shouldn't be part of the module.

We should do this step by step. One monster pull request is going to fail...

@timeturner
Copy link
Copy Markdown

@booo I like your approach. It keeps the implementation very distinct and clear especially when using it within an existing express app.

@Pita
Copy link
Copy Markdown
Contributor

Pita commented Feb 27, 2012

We're have a different aproach to solve the problem. The plugin system that gets created at the moment allows you to extend the express server. We should go down this road. Thx anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants