(This will also let you debug Geddy easily with WebStorm.)
Intended only for development. Do not use on production systems.
Note: Experimental. Use at your own risk.
The purpose of this package is to minimize the need to restart Geddy while developing. The focus is in allowing small fixes to be made quickly, with the understanding that massive changes will still require restarting Geddy.
The package does not attempt to preserve any data between reloads. The principle here is the assumption that processing a HTTP request is a containable event with little effect on other HTTP requests. If that's not the case for your application, this package may not be good for you.
- Install Geddy locally using npm:
npm install geddy
- Install Geddy Hot Swapper locally using npm:
npm install geddy-hotswapper
Make a simple modification to your local copy of Geddy(!) to expose the application:
this.start function of
node_modules/geddy/lib/geddy.js, add the following
if geddyconfigdebug === truegeddyapp = app;
Instead of launching Geddy with
geddy, create a launch script which starts
Geddy and initializes Hot Swapper for Geddy. This file should be placed in the
root directory of your application.
Something along the lines of:
#!/usr/bin/env nodevar HotSwapper = require 'geddy-hotswapper' ;var hotSwapper = ;// Ignore changes in node moduleshotSwapperexclude 'node_modules' ;// Ignore changes in the launcher scripthotSwapperexclude 'app-debug.js' ;// Start watching for changes in fileshotSwapperstart;// Start Geddyvar geddy = require'geddy';var geddyOpts =environment: processenvGEDDY_ENVIRONMENT || 'development';geddystart geddyOpts ;// React to changes in files by reloading GeddyhotSwapperon 'swapped'var config = require 'geddy/lib/config' ;geddyconfig = configreadConfig geddyOpts ;geddyworkerconfig = geddyconfig;hotSwapperclear requireresolve './config/router' ;var geddyInit = require 'geddy/lib/init' ;geddyInitinit geddyapp console.log 'Matrix reloaded' ; ;;
If you want to set up WebStorm, create a Node.js Run/Debug Configuration with the following settings.
|Node interpreter||Point to node.exe|
|Working Directory||Your application's root directory|
|Application Parameters||As you see fit|
|Environment variables||As you see fit|
Tested on Windows, Node 0.10.22, and Geddy 0.11.8.
- Only works when Geddy configuration sets
debug = true.
- Only works when Geddy is running in single worker mode and does not use