about summary refs log tree commit diff
path: root/http.go
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-03-08 12:51:31 +0100
committerEmile <hanemile@protonmail.com>2019-03-08 12:51:31 +0100
commit5d82b21165ab6fa55230a4476ff60de513414b07 (patch)
tree6327ef8cf4b99890798a2d484f22241042a349fd /http.go
parent447138f713e063cc9e7f70d4d3b6ad0ba93f6213 (diff)
updated the api
Diffstat (limited to 'http.go')
-rw-r--r--http.go113
1 files changed, 94 insertions, 19 deletions
diff --git a/http.go b/http.go
index 851fa53..af4fdba 100644
--- a/http.go
+++ b/http.go
@@ -18,32 +18,99 @@ package main
 
 import (
 	"database/sql"
-	"git.darknebu.la/GalaxySimulator/db_actions"
+	"git.darknebu.la/GalaxySimulator/db-actions"
 	"git.darknebu.la/GalaxySimulator/structs"
 )
 
 // IndexEndpoint gives a basic overview over the api
 func indexEndpoint() string {
-	indexString := `Galaxy Simulator Database
+	indexString := `<html><body><h1>Galaxy Simulator Database</h1>
 
 API:
-	- / ("GET")
-	- /new ("POST")
-	- /printall ("GET")
-	- /insert/{treeindex} ("POST")
-	- /starlist/{treeindex} ("GET")
-	- /dumptree/{treeindex} ("GET")
-
-	- /updatetotalmass/{treeindex} ("GET")
-	- /updatecenterofmass/{treeindex} ("GET")
-
-	- /metrics ("GET")
-	- /export/{treeindex} ("POST")
-
-	- /fastinsertjson/{filename} ("GET")
-	- /fastinsertlist/{filename} ("GET")
-
-	- /readdir ("GET")
+<h3> / (GET) </h3>
+
+<h3> /new (POST) </h3>
+	Create a new Tree 
+	<br>
+	Parameters:
+	<ul>
+	<li>
+		w float64: width of the tree
+	</li>
+	</ul>
+
+<h3> /deleteStars (POST) </h3>
+	Delete all stars from the stars Table
+	<br>
+	Parameters:
+	<ul>
+	<li>
+		none
+	</li>
+	</ul>
+
+<h3> /deleteNodes (POST) </h3>
+	Delete all nodes from the nodes Table
+	<br>
+	Parameters:
+	<ul>
+	<li>
+		none
+	</li>
+	</ul>
+
+<h3> /starslist/go (GET) </h3>
+	List all stars using go-array format
+	<br>
+	Parameters:
+	<ul>
+	<li>
+		none
+	</li>
+	</ul>
+
+<h3> /starslist/csv (GET) </h3>
+	List all stars as a csv
+	<br>
+	Parameters:
+	<ul>
+	<li>
+		none
+	</li>
+	</ul>
+
+<h3> /updatetotalmass (POST) </h3>
+	Update the total mass of all the nodes in the tree with the given index
+	<br>
+	Parameters:
+	<ul>
+	<li>
+		index int: index of the tree	
+	</li>
+	</ul>
+
+<h3> /updatecenterofmass (POST) </h3>
+	Update the center of mass of all the nodes in the tree with the given index
+	<br>
+	Parameters:
+	<ul>
+	<li>
+		index int: index of the tree	
+	</li>
+	</ul>
+
+<h3> /genforesttree (GET) </h3>
+	Generate the forest representation of the tree with the given index 	
+	<br>
+	Parameters:
+	<ul>
+	<li>
+		index int: index of the tree	
+	</li>
+	</ul>
+
+</body>
+</html>	
 `
 
 	return indexString
@@ -95,3 +162,11 @@ func updateCenterOfMassEndpoint(db *sql.DB, index int64) {
 func genForestTreeEndpoint(db *sql.DB, index int64) string {
 	return db_actions.GenForestTree(db, index)
 }
+
+func initStarsTableEndpoint(db *sql.DB) {
+	db_actions.InitStarsTable(db)
+}
+
+func initNodesTableEndpoint(db *sql.DB) {
+	db_actions.InitNodesTable(db)
+}