Compare commits
7 Commits
85d5e342c1
...
afebaf0ee6
| Author | SHA1 | Date | |
|---|---|---|---|
| afebaf0ee6 | |||
| 2d1eb509f1 | |||
| 0409c28e4c | |||
| 47680dff22 | |||
| 32a5491472 | |||
| 34ef078dfe | |||
| 28506fd3f0 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
|
||||
./api/build/
|
||||
api2/
|
||||
**/build/
|
||||
out.js
|
||||
4
api/.haxerc
Normal file
4
api/.haxerc
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"version": "4.2.5",
|
||||
"resolveLibs": "scoped"
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
-lib tink_http
|
||||
-lib tink_web
|
||||
-lib tink_hxx
|
||||
#-lib tink_hxx
|
||||
-lib tink_json
|
||||
-lib tink_sql
|
||||
-lib hxnodejs
|
||||
-cp src
|
||||
--main Server
|
||||
|
||||
3
api/haxe_libraries/http-status.hxml
Normal file
3
api/haxe_libraries/http-status.hxml
Normal file
@ -0,0 +1,3 @@
|
||||
# @install: lix --silent download "haxelib:/http-status#1.3.1" into http-status/1.3.1/haxelib
|
||||
-cp ${HAXE_LIBCACHE}/http-status/1.3.1/haxelib/src
|
||||
-D http-status=1.3.1
|
||||
7
api/haxe_libraries/hxnodejs.hxml
Normal file
7
api/haxe_libraries/hxnodejs.hxml
Normal file
@ -0,0 +1,7 @@
|
||||
# @install: lix --silent download "haxelib:/hxnodejs#12.1.0" into hxnodejs/12.1.0/haxelib
|
||||
-cp ${HAXE_LIBCACHE}/hxnodejs/12.1.0/haxelib/src
|
||||
-D hxnodejs=12.1.0
|
||||
--macro allowPackage('sys')
|
||||
# should behave like other target defines and not be defined in macro context
|
||||
--macro define('nodejs')
|
||||
--macro _internal.SuppressDeprecated.run()
|
||||
4
api/haxe_libraries/tink_anon.hxml
Normal file
4
api/haxe_libraries/tink_anon.hxml
Normal file
@ -0,0 +1,4 @@
|
||||
# @install: lix --silent download "haxelib:/tink_anon#0.7.0" into tink_anon/0.7.0/haxelib
|
||||
-lib tink_macro
|
||||
-cp ${HAXE_LIBCACHE}/tink_anon/0.7.0/haxelib/src
|
||||
-D tink_anon=0.7.0
|
||||
7
api/haxe_libraries/tink_await.hxml
Normal file
7
api/haxe_libraries/tink_await.hxml
Normal file
@ -0,0 +1,7 @@
|
||||
# @install: lix --silent download "haxelib:/tink_await#0.6.0" into tink_await/0.6.0/haxelib
|
||||
-lib tink_core
|
||||
-lib tink_macro
|
||||
-lib tink_syntaxhub
|
||||
-cp ${HAXE_LIBCACHE}/tink_await/0.6.0/haxelib/src
|
||||
-D tink_await=0.6.0
|
||||
--macro tink.await.Await.use()
|
||||
3
api/haxe_libraries/tink_chunk.hxml
Normal file
3
api/haxe_libraries/tink_chunk.hxml
Normal file
@ -0,0 +1,3 @@
|
||||
# @install: lix --silent download "haxelib:/tink_chunk#0.4.0" into tink_chunk/0.4.0/haxelib
|
||||
-cp ${HAXE_LIBCACHE}/tink_chunk/0.4.0/haxelib/src
|
||||
-D tink_chunk=0.4.0
|
||||
3
api/haxe_libraries/tink_core.hxml
Normal file
3
api/haxe_libraries/tink_core.hxml
Normal file
@ -0,0 +1,3 @@
|
||||
# @install: lix --silent download "haxelib:/tink_core#2.0.2" into tink_core/2.0.2/haxelib
|
||||
-cp ${HAXE_LIBCACHE}/tink_core/2.0.2/haxelib/src
|
||||
-D tink_core=2.0.2
|
||||
7
api/haxe_libraries/tink_http.hxml
Normal file
7
api/haxe_libraries/tink_http.hxml
Normal file
@ -0,0 +1,7 @@
|
||||
# @install: lix --silent download "haxelib:/tink_http#0.10.0" into tink_http/0.10.0/haxelib
|
||||
-lib http-status
|
||||
-lib tink_anon
|
||||
-lib tink_io
|
||||
-lib tink_url
|
||||
-cp ${HAXE_LIBCACHE}/tink_http/0.10.0/haxelib/src
|
||||
-D tink_http=0.10.0
|
||||
5
api/haxe_libraries/tink_io.hxml
Normal file
5
api/haxe_libraries/tink_io.hxml
Normal file
@ -0,0 +1,5 @@
|
||||
# @install: lix --silent download "haxelib:/tink_io#0.9.0" into tink_io/0.9.0/haxelib
|
||||
-lib tink_chunk
|
||||
-lib tink_streams
|
||||
-cp ${HAXE_LIBCACHE}/tink_io/0.9.0/haxelib/src
|
||||
-D tink_io=0.9.0
|
||||
4
api/haxe_libraries/tink_json.hxml
Normal file
4
api/haxe_libraries/tink_json.hxml
Normal file
@ -0,0 +1,4 @@
|
||||
# @install: lix --silent download "haxelib:/tink_json#0.11.0" into tink_json/0.11.0/haxelib
|
||||
-lib tink_typecrawler
|
||||
-cp ${HAXE_LIBCACHE}/tink_json/0.11.0/haxelib/src
|
||||
-D tink_json=0.11.0
|
||||
4
api/haxe_libraries/tink_macro.hxml
Normal file
4
api/haxe_libraries/tink_macro.hxml
Normal file
@ -0,0 +1,4 @@
|
||||
# @install: lix --silent download "haxelib:/tink_macro#1.0.0" into tink_macro/1.0.0/haxelib
|
||||
-lib tink_core
|
||||
-cp ${HAXE_LIBCACHE}/tink_macro/1.0.0/haxelib/src
|
||||
-D tink_macro=1.0.0
|
||||
3
api/haxe_libraries/tink_priority.hxml
Normal file
3
api/haxe_libraries/tink_priority.hxml
Normal file
@ -0,0 +1,3 @@
|
||||
# @install: lix --silent download "haxelib:/tink_priority#0.1.4" into tink_priority/0.1.4/haxelib
|
||||
-cp ${HAXE_LIBCACHE}/tink_priority/0.1.4/haxelib/src
|
||||
-D tink_priority=0.1.4
|
||||
5
api/haxe_libraries/tink_querystring.hxml
Normal file
5
api/haxe_libraries/tink_querystring.hxml
Normal file
@ -0,0 +1,5 @@
|
||||
# @install: lix --silent download "haxelib:/tink_querystring#0.7.0" into tink_querystring/0.7.0/haxelib
|
||||
-lib tink_typecrawler
|
||||
-lib tink_url
|
||||
-cp ${HAXE_LIBCACHE}/tink_querystring/0.7.0/haxelib/src
|
||||
-D tink_querystring=0.7.0
|
||||
3
api/haxe_libraries/tink_spatial.hxml
Normal file
3
api/haxe_libraries/tink_spatial.hxml
Normal file
@ -0,0 +1,3 @@
|
||||
# @install: lix --silent download "gh://github.com/haxetink/tink_spatial#fb0d0a02ceed49325709215b5da0062fd8316c62" into tink_spatial/0.1.0/github/fb0d0a02ceed49325709215b5da0062fd8316c62
|
||||
-cp ${HAXE_LIBCACHE}/tink_spatial/0.1.0/github/fb0d0a02ceed49325709215b5da0062fd8316c62/src
|
||||
-D tink_spatial=0.1.0
|
||||
7
api/haxe_libraries/tink_sql.hxml
Normal file
7
api/haxe_libraries/tink_sql.hxml
Normal file
@ -0,0 +1,7 @@
|
||||
# @install: lix --silent download "gh://github.com/haxetink/tink_sql#3b8fef55ba9153b78c07e8722a76d077f4d40cb8" into tink_sql/0.0.0-alpha.0/github/3b8fef55ba9153b78c07e8722a76d077f4d40cb8
|
||||
-lib tink_macro
|
||||
-lib tink_spatial
|
||||
-lib tink_streams
|
||||
-lib tink_url
|
||||
-cp ${HAXE_LIBCACHE}/tink_sql/0.0.0-alpha.0/github/3b8fef55ba9153b78c07e8722a76d077f4d40cb8/src
|
||||
-D tink_sql=0.0.0-alpha.0
|
||||
6
api/haxe_libraries/tink_streams.hxml
Normal file
6
api/haxe_libraries/tink_streams.hxml
Normal file
@ -0,0 +1,6 @@
|
||||
# @install: lix --silent download "gh://github.com/haxetink/tink_streams#c51ff28d69ea844995696f10575d1a150ce47159" into tink_streams/0.3.3/github/c51ff28d69ea844995696f10575d1a150ce47159
|
||||
-lib tink_core
|
||||
-cp ${HAXE_LIBCACHE}/tink_streams/0.3.3/github/c51ff28d69ea844995696f10575d1a150ce47159/src
|
||||
-D tink_streams=0.3.3
|
||||
# temp for development, delete this file when pure branch merged
|
||||
-D pure
|
||||
4
api/haxe_libraries/tink_stringly.hxml
Normal file
4
api/haxe_libraries/tink_stringly.hxml
Normal file
@ -0,0 +1,4 @@
|
||||
# @install: lix --silent download "haxelib:/tink_stringly#0.4.0" into tink_stringly/0.4.0/haxelib
|
||||
-lib tink_core
|
||||
-cp ${HAXE_LIBCACHE}/tink_stringly/0.4.0/haxelib/src
|
||||
-D tink_stringly=0.4.0
|
||||
6
api/haxe_libraries/tink_syntaxhub.hxml
Normal file
6
api/haxe_libraries/tink_syntaxhub.hxml
Normal file
@ -0,0 +1,6 @@
|
||||
# @install: lix --silent download "haxelib:/tink_syntaxhub#0.5.0" into tink_syntaxhub/0.5.0/haxelib
|
||||
-lib tink_macro
|
||||
-lib tink_priority
|
||||
-cp ${HAXE_LIBCACHE}/tink_syntaxhub/0.5.0/haxelib/src
|
||||
-D tink_syntaxhub=0.5.0
|
||||
--macro tink.SyntaxHub.use()
|
||||
4
api/haxe_libraries/tink_typecrawler.hxml
Normal file
4
api/haxe_libraries/tink_typecrawler.hxml
Normal file
@ -0,0 +1,4 @@
|
||||
# @install: lix --silent download "haxelib:/tink_typecrawler#0.7.0" into tink_typecrawler/0.7.0/haxelib
|
||||
-lib tink_macro
|
||||
-cp ${HAXE_LIBCACHE}/tink_typecrawler/0.7.0/haxelib/src
|
||||
-D tink_typecrawler=0.7.0
|
||||
5
api/haxe_libraries/tink_url.hxml
Normal file
5
api/haxe_libraries/tink_url.hxml
Normal file
@ -0,0 +1,5 @@
|
||||
# @install: lix --silent download https://github.com/haxetink/tink_url/archive/7c98a2ea212c3a2f8d9ff41c1450eae98eee812f.tar.gz into tink_url/0.3.1/github/7c98a2ea212c3a2f8d9ff41c1450eae98eee812f
|
||||
-D tink_url=0.3.1
|
||||
-cp ${HAXESHIM_LIBCACHE}/tink_url/0.3.1/github/7c98a2ea212c3a2f8d9ff41c1450eae98eee812f/src
|
||||
|
||||
-lib tink_stringly
|
||||
6
api/haxe_libraries/tink_web.hxml
Normal file
6
api/haxe_libraries/tink_web.hxml
Normal file
@ -0,0 +1,6 @@
|
||||
# @install: lix --silent download "haxelib:/tink_web#0.3.0" into tink_web/0.3.0/haxelib
|
||||
-lib tink_http
|
||||
-lib tink_json
|
||||
-lib tink_querystring
|
||||
-cp ${HAXE_LIBCACHE}/tink_web/0.3.0/haxelib/src
|
||||
-D tink_web=0.3.0
|
||||
0
api/readme.md
Normal file
0
api/readme.md
Normal file
@ -1,9 +1,10 @@
|
||||
import html.Document;
|
||||
import html.WebDocument;
|
||||
import tink.http.containers.*;
|
||||
import tink.http.Response;
|
||||
import tink.web.routing.*;
|
||||
import haxe.Json;
|
||||
|
||||
import tink.sql.drivers.Sqlite;
|
||||
import db.Db;
|
||||
|
||||
|
||||
typedef T_project = {
|
||||
@ -30,15 +31,39 @@ class Server {
|
||||
|
||||
class Root {
|
||||
public function new() {}
|
||||
|
||||
|
||||
@:get('/')
|
||||
@:produces('text/html')
|
||||
public function root(){
|
||||
return Document.render();
|
||||
//return "yeet";
|
||||
return WebDocument.render();
|
||||
}
|
||||
|
||||
@:get('/test')
|
||||
@:produces('text/html')
|
||||
@async
|
||||
public function create(){
|
||||
//return "yeet";
|
||||
var yeet = "yote";
|
||||
var driver = new tink.sql.drivers.Sqlite();
|
||||
@await var db = new Db('daba2', driver);
|
||||
@await var one = db.User.create();
|
||||
@await var two = db.User.insertOne({
|
||||
id: cast null,
|
||||
name: 'Alice',
|
||||
email: 'alice@example.com',
|
||||
password: 'jew'
|
||||
});
|
||||
@await var three = db.User.select({name: User.name, email: User.email}).where(User.email == 'alice@example.com').first().next(function(row) {
|
||||
trace(row.name);return "";
|
||||
});
|
||||
// trace(@await one);
|
||||
// trace(@await two);
|
||||
trace(@await three);
|
||||
return '$yeet';
|
||||
}
|
||||
|
||||
@:sub('/projects')
|
||||
@:produces('application/json')
|
||||
public function projects()
|
||||
return new Projects();
|
||||
|
||||
@ -49,6 +74,7 @@ class Root {
|
||||
var strout:String = tink.Json.stringify(greeting);
|
||||
return strout;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Projects {
|
||||
|
||||
10
api/src/db/Connection.hx
Normal file
10
api/src/db/Connection.hx
Normal file
@ -0,0 +1,10 @@
|
||||
package db;
|
||||
|
||||
import tink.sql.drivers.sys.Sqlite;
|
||||
import tink.sql.drivers.MySql;
|
||||
import db.Db;
|
||||
|
||||
class Connection{
|
||||
private static var driver = new tink.sql.drivers.Sqlite();
|
||||
public static var db = new Db('daba', driver);
|
||||
}
|
||||
17
api/src/db/Db.hx
Normal file
17
api/src/db/Db.hx
Normal file
@ -0,0 +1,17 @@
|
||||
package db;
|
||||
|
||||
// import tink.sql.drivers.Sqlite;
|
||||
//import tink.sql.Database;
|
||||
import tink.sql.Types;
|
||||
import model.User;
|
||||
|
||||
// import db.Models.User;
|
||||
|
||||
|
||||
|
||||
typedef Db = tink.sql.Database<Def>;
|
||||
@:tables(User)
|
||||
interface Def extends tink.sql.DatabaseDefinition {
|
||||
//@:procedure var func:Int->{x:Int, point:tink.s2d.Point};
|
||||
//@:table('user') var UserAlias:User;
|
||||
}
|
||||
11
api/src/db/Models.hx
Normal file
11
api/src/db/Models.hx
Normal file
@ -0,0 +1,11 @@
|
||||
package db;
|
||||
|
||||
import tink.sql.Types;
|
||||
|
||||
|
||||
typedef User = {
|
||||
@:autoIncrement @:primary public var id(default, null):Id<User>;
|
||||
var name:VarChar<255>;
|
||||
@:unique var email:VarChar<255>;
|
||||
var password:VarChar<255>;
|
||||
}
|
||||
@ -1,8 +1,14 @@
|
||||
package html;
|
||||
|
||||
class Document{
|
||||
//import tink.web.macros.Routing;
|
||||
import tink.web.routing.*;
|
||||
import tink.web.routing.Router;
|
||||
|
||||
|
||||
class WebDocument{
|
||||
public static function render():String
|
||||
{
|
||||
|
||||
var docroot:Tag = new Tag("html");
|
||||
var head:Tag = new Tag("head");
|
||||
var body:Tag = new Tag("body");
|
||||
11
api/src/model/User.hx
Normal file
11
api/src/model/User.hx
Normal file
@ -0,0 +1,11 @@
|
||||
package model;
|
||||
|
||||
import tink.sql.Types;
|
||||
|
||||
|
||||
typedef User = {
|
||||
@:autoIncrement @:primary public var id(default, null):Id<User>;
|
||||
public var name:VarChar<50>;
|
||||
public var email:VarChar<50>;
|
||||
public var password:VarChar<50>;
|
||||
}
|
||||
9
api/src/model/cctweaked/HTurtle.hx
Normal file
9
api/src/model/cctweaked/HTurtle.hx
Normal file
@ -0,0 +1,9 @@
|
||||
package model.cctweaked;
|
||||
|
||||
import tink.sql.Types;
|
||||
|
||||
typedef HTurtle = {
|
||||
@:autoIncrement @:primary public var id(default, null):Id<HTurtle>;
|
||||
public var name:VarChar<50>;
|
||||
public var password:VarChar<50>;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user