various changes
This commit is contained in:
+32
-6
@@ -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 = {
|
||||
@@ -29,16 +30,40 @@ class Server {
|
||||
}
|
||||
|
||||
class Root {
|
||||
public function new() {}
|
||||
|
||||
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user