Compare commits
13 Commits
master
...
5e0768263f
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e0768263f | |||
| 6bf0ca0d74 | |||
| 3bcb921032 | |||
| 963d4d1750 | |||
| afebaf0ee6 | |||
| 2d1eb509f1 | |||
| 0409c28e4c | |||
| 47680dff22 | |||
| 32a5491472 | |||
| 34ef078dfe | |||
| 28506fd3f0 | |||
| 85d5e342c1 | |||
| bfabca1845 |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
api2/
|
||||
**/build/
|
||||
out.js
|
||||
34
Dockerfile
Normal file
34
Dockerfile
Normal file
@@ -0,0 +1,34 @@
|
||||
FROM node:latest AS Build
|
||||
|
||||
RUN npm install haxe --global
|
||||
RUN npm install lix --global --force
|
||||
|
||||
|
||||
COPY ./api /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN lix scope
|
||||
RUN lix download
|
||||
RUN lix use haxe stable
|
||||
# RUN lix install haxelib:hxnodejs
|
||||
|
||||
|
||||
RUN haxe build.hxml
|
||||
|
||||
FROM node:latest
|
||||
|
||||
COPY --from=Build /app/build /app
|
||||
COPY --from=Build /app/package.json /app/package.json
|
||||
COPY --from=Build /app/res /app/res
|
||||
|
||||
|
||||
WORKDIR /app/
|
||||
|
||||
RUN npm install
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
# CMD ["node", "out.js"]
|
||||
CMD ["node", "out.js"]
|
||||
# CMD ["/bin/bash"]
|
||||
4
api/.haxerc
Normal file
4
api/.haxerc
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"version": "4.2.5",
|
||||
"resolveLibs": "scoped"
|
||||
}
|
||||
9
api/build.hxml
Normal file
9
api/build.hxml
Normal file
@@ -0,0 +1,9 @@
|
||||
-lib tink_http
|
||||
-lib tink_web
|
||||
#-lib tink_hxx
|
||||
-lib tink_json
|
||||
-lib tink_sql
|
||||
-lib hxnodejs
|
||||
-cp src
|
||||
--main Server
|
||||
-js build/out.js
|
||||
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 "gh://github.com/haxetink/tink_core#8fb0b9aa4de933614b5a04cc88da871b89cb8c6a" into tink_core/2.0.2/github/8fb0b9aa4de933614b5a04cc88da871b89cb8c6a
|
||||
-cp ${HAXE_LIBCACHE}/tink_core/2.0.2/github/8fb0b9aa4de933614b5a04cc88da871b89cb8c6a/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 "gh://github.com/haxetink/tink_macro#f3ddaa6496e3d0e82696c3ac9a7ccefac16954d4" into tink_macro/0.21.1/github/f3ddaa6496e3d0e82696c3ac9a7ccefac16954d4
|
||||
-lib tink_core
|
||||
-cp ${HAXE_LIBCACHE}/tink_macro/0.21.1/github/f3ddaa6496e3d0e82696c3ac9a7ccefac16954d4/src
|
||||
-D tink_macro=0.21.1
|
||||
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#9470dc0bd5557449992fbbfb15b3621e00c77e76" into tink_sql/0.0.0-alpha.0/github/9470dc0bd5557449992fbbfb15b3621e00c77e76
|
||||
-lib tink_macro
|
||||
-lib tink_spatial
|
||||
-lib tink_streams
|
||||
-lib tink_url
|
||||
-cp ${HAXE_LIBCACHE}/tink_sql/0.0.0-alpha.0/github/9470dc0bd5557449992fbbfb15b3621e00c77e76/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
|
||||
15
api/package.json
Normal file
15
api/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "drivebyapi",
|
||||
"version": "1.0.0",
|
||||
"description": "api",
|
||||
"main": "out.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"mysql": "^2.18.1",
|
||||
"sqlite3": "^5.0.11"
|
||||
}
|
||||
}
|
||||
0
api/readme.md
Normal file
0
api/readme.md
Normal file
0
api/res/html/index.html
Normal file
0
api/res/html/index.html
Normal file
0
api/res/html/index.js
Normal file
0
api/res/html/index.js
Normal file
20
api/res/json/projects.json
Normal file
20
api/res/json/projects.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version" : 1,
|
||||
"projects" : [
|
||||
{
|
||||
"name": "subsonicsnl",
|
||||
"description": "subsonics.nl website",
|
||||
"url": "https://subsonics.nl"
|
||||
},
|
||||
{
|
||||
"name": "drivebycool",
|
||||
"description": "driveby.cool website",
|
||||
"url": "https://driveby.cool"
|
||||
},
|
||||
{
|
||||
"name": "VaV Arena",
|
||||
"description": "Q3 CPMA inspired arena shooter",
|
||||
"url": "https://vav.driveby.cool"
|
||||
}
|
||||
]
|
||||
}
|
||||
106
api/src/Server.hx
Normal file
106
api/src/Server.hx
Normal file
@@ -0,0 +1,106 @@
|
||||
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;
|
||||
|
||||
import model.MUser;
|
||||
|
||||
|
||||
typedef T_project = {
|
||||
name : String,
|
||||
description : String,
|
||||
url : String
|
||||
}
|
||||
typedef T_projects = {
|
||||
version : Int,
|
||||
projects : Array<T_project>
|
||||
}
|
||||
|
||||
class Server {
|
||||
static function main() {
|
||||
var container = new NodeContainer(8080);
|
||||
//var container = PhpContainer.inst; //use PhpContainer instead of NodeContainer when targeting PHP
|
||||
var router = new Router<Root>(new Root());
|
||||
container.run(function(req) {
|
||||
return router.route(Context.ofRequest(req))
|
||||
.recover(OutgoingResponse.reportError);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class Root {
|
||||
public function new() {}
|
||||
@:get('/')
|
||||
@:produces('text/html')
|
||||
public function root(){
|
||||
//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.MUser.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();
|
||||
|
||||
@:get('/hello')
|
||||
@:produces('application/json')
|
||||
public function hello(name = 'world'){
|
||||
var greeting = { hello: name, foo: 42 };
|
||||
var strout:String = tink.Json.stringify(greeting);
|
||||
return strout;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Projects {
|
||||
public function new() {}
|
||||
|
||||
public var path:String = "./res/json/projects.json";
|
||||
|
||||
@:get('/')
|
||||
@:produces('application/json')
|
||||
public function projects(){
|
||||
var json:String = Utils.getJson(path);
|
||||
return json;
|
||||
}
|
||||
@:get('/project/by_name/$name')
|
||||
@:produces('application/json')
|
||||
public function project(name:String){
|
||||
var json:String = Utils.getJson(path);
|
||||
var _projects:T_projects = Json.parse(json);
|
||||
json = "{}";
|
||||
for(_project in _projects.projects){
|
||||
if(_project.name == name){
|
||||
json = tink.Json.stringify(_project);
|
||||
}
|
||||
}
|
||||
return json;
|
||||
}
|
||||
}
|
||||
24
api/src/Utils.hx
Normal file
24
api/src/Utils.hx
Normal file
@@ -0,0 +1,24 @@
|
||||
package;
|
||||
|
||||
import sys.io.File;
|
||||
import sys.FileSystem;
|
||||
|
||||
|
||||
class Utils{
|
||||
public static function getHTML(path:String):String
|
||||
{
|
||||
var strout:String = "<html></html>";
|
||||
if(FileSystem.exists(path)){
|
||||
strout = File.getContent(path);
|
||||
}
|
||||
return strout;
|
||||
}
|
||||
public static function getJson(path:String):String
|
||||
{
|
||||
var strout:String = "{}";
|
||||
if(FileSystem.exists(path)){
|
||||
strout = File.getContent(path);
|
||||
}
|
||||
return strout;
|
||||
}
|
||||
}
|
||||
0
api/src/VDom.hx
Normal file
0
api/src/VDom.hx
Normal file
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.MUser;
|
||||
|
||||
// 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>;
|
||||
}
|
||||
8
api/src/html/BaseRenderable.hx
Normal file
8
api/src/html/BaseRenderable.hx
Normal file
@@ -0,0 +1,8 @@
|
||||
package html;
|
||||
|
||||
class BaseRenderable{
|
||||
public var bIsContainer:Bool = true;
|
||||
public function render(){
|
||||
|
||||
}
|
||||
}
|
||||
7
api/src/html/RenderableContainer.hx
Normal file
7
api/src/html/RenderableContainer.hx
Normal file
@@ -0,0 +1,7 @@
|
||||
package html;
|
||||
|
||||
class RenderableContainer extends BaseRenderable{
|
||||
override function render() {
|
||||
super.render();
|
||||
}
|
||||
}
|
||||
44
api/src/html/Tag.hx
Normal file
44
api/src/html/Tag.hx
Normal file
@@ -0,0 +1,44 @@
|
||||
package html;
|
||||
|
||||
class Tag{
|
||||
public var children:Array<Tag> = [];
|
||||
public var name:String = "";
|
||||
public var props:Array<String>;
|
||||
public var textonly:Bool;
|
||||
public var text:String = "";
|
||||
public static var dochead:Tag;
|
||||
public function new(_name:String, _props:Array<String>=null, _text = "", _textonly=false){
|
||||
name = _name;
|
||||
textonly = _textonly;
|
||||
if(_props != null) props = _props;
|
||||
text = _text;
|
||||
}
|
||||
public static function createTextElement(_text:String):Tag
|
||||
{
|
||||
var tag = new Tag("t",null,_text,true);
|
||||
tag.text = _text;
|
||||
return tag;
|
||||
}
|
||||
public function render():String
|
||||
{
|
||||
var strout:String = "";
|
||||
if(!textonly){
|
||||
var strProps:String = "";
|
||||
if(props != null){
|
||||
for(prop in props) strProps+=prop+" ";
|
||||
}
|
||||
strout+="<"+name+" "+strProps+" "+">";
|
||||
strout+=text;
|
||||
trace(text);
|
||||
for(tag in children){
|
||||
strout+=tag.render();
|
||||
}
|
||||
strout+="</"+name+">";
|
||||
}
|
||||
else{
|
||||
strout = text;
|
||||
}
|
||||
trace(strout);
|
||||
return strout;
|
||||
}
|
||||
}
|
||||
24
api/src/html/WebDocument.hx
Normal file
24
api/src/html/WebDocument.hx
Normal file
@@ -0,0 +1,24 @@
|
||||
package html;
|
||||
|
||||
//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");
|
||||
var h1:Tag = new Tag("h1",['class="yeet"'],"Api endpoints:");
|
||||
var a_yeet:Tag = new Tag("a",['href="projects"'],"projects");
|
||||
var a_yeet:Tag = new Tag("a",['href="projects/project/by_name/"'],"projects");
|
||||
docroot.children.push(head);
|
||||
docroot.children.push(body);
|
||||
body.children.push(h1);
|
||||
body.children.push(a_yeet);
|
||||
return docroot.render();
|
||||
}
|
||||
}
|
||||
8
api/src/model/MService.hx
Normal file
8
api/src/model/MService.hx
Normal file
@@ -0,0 +1,8 @@
|
||||
package model;
|
||||
|
||||
import tink.sql.Types;
|
||||
|
||||
typedef MService = {
|
||||
@:autoIncrement @:primary public var id(default, null):Id<MService>;
|
||||
public var name:VarChar<50>;
|
||||
}
|
||||
12
api/src/model/MUser.hx
Normal file
12
api/src/model/MUser.hx
Normal file
@@ -0,0 +1,12 @@
|
||||
package model;
|
||||
|
||||
import tink.sql.Types;
|
||||
import model.MService;
|
||||
|
||||
typedef MUser = {
|
||||
@:autoIncrement @:primary public var id(default, null):Id<MUser>;
|
||||
public var name:VarChar<50>;
|
||||
public var email:VarChar<50>;
|
||||
public var password:VarChar<50>;
|
||||
public var services:Id<MService>;
|
||||
}
|
||||
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>;
|
||||
}
|
||||
18
api/src/model/services/DrivebyCool.hx
Normal file
18
api/src/model/services/DrivebyCool.hx
Normal file
@@ -0,0 +1,18 @@
|
||||
package model.sites.drivebycool;
|
||||
|
||||
import tink.sql.Types;
|
||||
|
||||
|
||||
typedef MSubscription = {
|
||||
@:autoIncrement @:primary public var id(default, null):Id<MSubscription>;
|
||||
public var subscriber:VarChar<50>;
|
||||
public var project:Id<MUser>;
|
||||
public var subscribers:Id<Subscription>;
|
||||
}
|
||||
|
||||
typedef MProject = {
|
||||
@:autoIncrement @:primary public var id(default, null):Id<MProject>;
|
||||
public var name:VarChar<50>;
|
||||
public var owner:Id<MUser>;
|
||||
public var subscribers:Id<Subscription>;
|
||||
}
|
||||
14
api/src/model/services/ProjectTracker.hx
Normal file
14
api/src/model/services/ProjectTracker.hx
Normal file
@@ -0,0 +1,14 @@
|
||||
package model.services;
|
||||
|
||||
typedef MMembership = {
|
||||
@:autoIncrement @:primary public var id(default, null):Id<MMembership>;
|
||||
public var project:Id<MProject>;
|
||||
public var user:Id<MUser>;
|
||||
}
|
||||
|
||||
typedef MProject = {
|
||||
@:autoIncrement @:primary public var id(default, null):Id<MProject>;
|
||||
public var name:VarChar<50>;
|
||||
public var owner:Id<MUser>;
|
||||
public var members:Id<MMembership>;
|
||||
}
|
||||
0
api/src/res/a
Normal file
0
api/src/res/a
Normal file
20
api/src/res/json/projects.json
Normal file
20
api/src/res/json/projects.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version" : 1,
|
||||
"projects" : [
|
||||
{
|
||||
"name": "subsonicsnl",
|
||||
"description": "subsonics.nl website",
|
||||
"url": "https://subsonics.nl"
|
||||
},
|
||||
{
|
||||
"name": "drivebycool",
|
||||
"description": "driveby.cool website",
|
||||
"url": "https://driveby.cool"
|
||||
},
|
||||
{
|
||||
"name": "VaV Arena",
|
||||
"description": "Q3 CPMA inspired arena shooter",
|
||||
"url": "https://vav.driveby.cool"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user