Skip to content

Proposal: Make Diet Flexible #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
frank-dspeed opened this issue May 20, 2016 · 2 comments
Open

Proposal: Make Diet Flexible #47

frank-dspeed opened this issue May 20, 2016 · 2 comments

Comments

@frank-dspeed
Copy link
Contributor

frank-dspeed commented May 20, 2016

We should de couple all parts of DietJS that are at present bound to the listen function.

we should export a method that creates the server
and should export a method that creates the Host so that

http.createServer(diet.hosts['app in this array']).listen(9011);

maybe rename diet.hosts that get matched to diet apps so that it gets clear that this are complet diet.apps

so that we can create apps for hostmatches in

diet = require diet // returns server and app part but app part
server = diet.server() // init diet server object


// allwo to give app as options and if not given a diet.app() instance we simply init one and return that as app to that host
server.listen({ location: '', app1})

app1 = diet.app() // returns only app relevant parts not the server parts
app2 = diet.app() // returns only app relevant parts not the server parts

if app not present simply use diet (this)

this will then allow more clear app seperation and less confusing when listing with more then one diet instance.

some people even dont understand that diet = require diet is a object thats not allowed to be re instanced if you make many apps it only works with seperated files because nodejs returns same object for already required objects.

@adamhalasz adamhalasz changed the title Proposal: Make Diet Flexibel Proposal: Make Diet Flexible Feb 27, 2017
@frank-dspeed
Copy link
Contributor Author

  • Create diet.signal() method for manual creating signal from server
  • Helper methods for get set internal server array
  • Should be easy to use existing server instances.

@frank-dspeed
Copy link
Contributor Author

Related #43

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

No branches or pull requests

2 participants