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

Already on GitHub? Sign in to your account

Workflow for integrating Brunch in a Node.js/Express app #453

Closed
DjebbZ opened this Issue Dec 26, 2012 · 9 comments

Comments

Projects
None yet
6 participants

DjebbZ commented Dec 26, 2012

Hi

I managed to successfully integrate Brunch in an Express-based app. Anyone interested in seeing how can view my slides (very easy, see the slide named Bonus #1).

What I'd like to achieve is avoiding during development to have to open 2 console/Terminal tabs to separately launch node app.js and brunch watch. My wish is to have only one command to type that launch both my node backend to serve content and the watch process of Brunch. Ideally this command would be an npm scripts located in package.json. This will simplify the dev workflow and make it less error-prone.

Does it make sense ? Is it feasible ? Any hint appreciated.

Owner

paulmillr commented Dec 26, 2012

http://brunch.readthedocs.org/en/latest/config.html#server

config.server.path = 'app.js'

# app.js
exports.startServer = function() {
  # starts express server
}

@paulmillr paulmillr closed this Dec 26, 2012

DjebbZ commented Dec 26, 2012

Man, Brunch rocks. I got it working in no time, by using exports.startServer in my own code to launch the server so that it's not launched twice.

Just a question to better understand Brunch : the callback argument is not described in the docs as an option of config.server.path. Do we have to define it here ? And what is exactly the path option for ? I don't get it from reading the docs. Thanks in advance.

Owner

paulmillr commented Dec 27, 2012

@DjebbZ path is path to public directory on which server will be served. you can ignore it.

callback is needed to be run after server start.

DjebbZ commented Dec 27, 2012

Strange, I don't use the callback parameter at all and everything works
fine.

Khalid aka DjebbZ
@dj3bbz

Le 27 déc. 2012 à 23:32, Paul Miller notifications@github.com a écrit :

@DjebbZ https://github.com/DjebbZ path is path to public directory on
which server will be served. you can ignore it.

callback is needed to be run after server start.


Reply to this email directly or view it on
GitHubhttps://github.com/brunch/brunch/issues/453#issuecomment-11720234.

@KingScooty KingScooty referenced this issue in KingScooty/node-express-3.0-html5-boilerplate Jan 11, 2013

Open

Switch js/css management and compiling over to Brunch #2

Contributor

jkresner commented Feb 18, 2013

Awesome just what I needed. Love brunch even more now.

gabbsmo commented Aug 2, 2013

I like the idea but I have not managed to get auto-reload-brunch working with this setup. It is also a little annoying to have to restart the server when I change something on the server side, usually I use nodemon.

Have anyone managed to work around these issues?

Contributor

jkresner commented Aug 2, 2013

This is what I do:

http://hackerpreneurialism.com/post/43379675961/nodejs-with-bunch-io

Have never had brunch-auto-reload working. I'm just in the habit of restarting the server ...

Owner

es128 commented Aug 2, 2013

Yes, in the ExpressBrunchJade skeleton. He ended up breaking off the part that watches and reloads node server files into a separate module https://github.com/jerfowler/cordell.

jhabdas commented Dec 24, 2014

Here's an alternative, one-task approach to going full-stack using Hapi, useful in creating reverse proxies without all the middleware. 🔥 it up with npm start.

And here's a dockerfile if you'd prefer to work with cached dependencies for a faster install.

zenithtekla referenced this issue in zenithtekla/nodeMySQL Sep 20, 2016

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