/ss-angular-demo

Primary LanguageJavaScriptMIT LicenseMIT

This is a seed project for a web app that uses

I'm using it to seed new web apps, and as a playground for quickly trying new things.

$ npm install
$ node app.js

To run server side tests

$ make

To run client side tests

$ node app.js

...then open browser to http://localhost:3000/tests

Routing Examples

Demo app has some routes that are 100% client side, and some that are server-side...meaning client side routes are intercepted by Angular and handled in the browser, since this is a single page app. Conversely, server side routes are handled as new HTTP request to the browser which are processed by ExpressJS routing -- demonstration of how one can still provide a web service API on top of the SocketStream RPC/WebSocket application (e.g. for other clients or integration points).

Client Side Routing

Handled by route.js and AppCtrl and the AngularJS ng-switch directive.

Example Routes

There is a controller for each route.

Server Side Routing

Any JS files found under routes dir will be added to ExpressJS routing processor. There is a demoRoute.js which shows a standard web service request that returns some JSON

There's also an example of shared middleware -- a piece of middleware that can be injected into the path for both websockets and standard ExpressJS http routes.

That piece of middleware will run if a client hits http://localhost:3000/demo and it will also run if they call ss.rpc('demoRpc.get', function (err, resp) { });

Credit Due