Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add a remote example

  • Loading branch information...
commit e2268ecac9371a5687505636db37263aecaec136 1 parent d7634b9
@cloudshift authored
View
6 usage/data/Makefile
@@ -0,0 +1,6 @@
+
+all:
+ haxe build.hxml
+
+run:
+ node remoteSource.js
View
27 usage/data/RemoteClient.hx
@@ -0,0 +1,27 @@
+
+import cloudshift.Core;
+import cloudshift.Data;
+import cloudshift.Http;
+
+using cloudshift.Mixin;
+
+class RemoteClient {
+
+ public static function main(){
+ Data.store(REMOTESQLITE("http://localhost:8082/data/woot")).deliver(function(store) {
+ store.bucket("woot").deliver(function(woot) {
+
+ woot.where('name="lore"').deliver(function(recs) {
+ trace(recs.stringify());
+ });
+
+ woot.insert({email:"lorena@ritchie.com",name:"lore",passwd:"and why not"})
+ .deliver(function(u) {
+ trace("lore's id = "+Data.oid(u));
+ });
+ });
+ });
+
+ }
+
+}
View
24 usage/data/RemoteSource.hx
@@ -0,0 +1,24 @@
+
+import cloudshift.Http;
+import cloudshift.Core;
+import cloudshift.Data;
+
+using cloudshift.Mixin;
+
+class RemoteSource {
+
+ public static function main(){
+ Http.server().root("www").start({host:"localhost",port:8082}).deliver(function(server) {
+ Data.store(SQLITE("test.db")).deliver(function(store) {
+ store.bucket("woot").deliver(function(woot) {
+ woot.indexer("name",function(o:Dynamic) {
+ return o.name;
+ }).deliver(function(el) {
+ Data.serve(server,woot,"/data/woot");
+ });
+ });
+ });
+ });
+ }
+
+}
View
23 usage/data/build.hxml
@@ -0,0 +1,23 @@
+
+-cp ../../../hx-node
+-cp ../../
+-cp .
+-js remoteSource.js
+-D nodejs
+-main RemoteSource
+--macro cloudshift.core.JSGenerator.use()
+-cmd echo compiled server
+--times
+
+--next
+
+-cp ../../../hx-node
+-cp ../../
+-cp .
+-D nodejs
+-main RemoteClient
+--macro cloudshift.core.JSGenerator.use()
+-js remoteClient.js
+-cmd echo compiled client
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.