0.0.19 • Published 9 years ago

isomagic v0.0.19

Weekly downloads
1
License
MIT
Repository
-
Last release
9 years ago

IsoMagic

An Isomorphic Javascript Framework based on Express and TLC

What?

  • Isomorphic- Runs on the Server and the Browser. Write it once, works on both.
  • Easily Extendable
  • Simple Workflows- Express-style middleware, TLC formats, that's it.
  • Maintainable- Well structured TLC formats reduce javascript, offloading data translation to the template files

How?

Install with npm npm install isomagic

Server

Write your index.js

//index.js
var config = require('./path/to/config.json'); //configuration object, same object as the client
var IsoMagic = require('isomagic');
var myApp = new IsoMagic(config, function(_app){
	//This callback recieves a reference to the app that has loaded to avoid scoping issues
	_app.listen(3000);
});

Client

Create your index.html. There's a few files you're going to need to add to your head:

By default, IsoMagic includes express.static middleware pointed at the CWD, so it will serve those JS files as long as they're in your project, and you use the appropriate path.

<!doctype html>
<html>
<head>
	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
	<!-- Order is important for the following files -->
	<script type="text/javascript" src="path/to/clientrouter/path-to-regexp.js"></script>
	<script type="text/javascript" src="path/to/clientrouter/layer.js"></script>
	<script type="text/javascript" src="path/to/clientrouter/route.js"></script>
	<script type="text/javascript" src="path/to/clientrouter/index.js"></script>
	<script type="text/javascript" src="path/to/lodash.min.js"></script>
	<script type="text/javascript" src="path/to/jsonpath.js"></script>
	<script type="text/javascript" src="path/to/peg-0.8.0.js"></script>
	<script type="text/javascript" src="path/to/tlc.js"></script>
	<script type="text/javascript" src="path/to/isomagic.js"></script>
	<script type="text/javascript">
		$(function(){
			//jQuery is currently required, so why not use a convenience method to load the config.json file?
			$.getJSON('path/to/config.json', function(config){ // Same config object you loaded on the server
				var myApp = new IsoMagic(config, function(){
					console.log('app has loaded!');
				});
			});
		}); 
	</script>
</head>
<body>
	<h1>Hello World!</h1>
</body>
</html>

Alright, we're serving some html! Next you need to install some extensions, and configure your app

For a simple example app, check out isomagic-simpleapp

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago