Skip to content

Commit

Permalink
Fixed some things
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCGuyGitHub committed Jun 30, 2024
1 parent 5a3540e commit 113c33d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4,674 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
name: skRedis-Artifact
name: CloudNet-Rest-Module
path: build/libs/CloudNet-Rest-Module-1.0-SNAPSHOT-all.jar
4 changes: 1 addition & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ dependencies {
implementation("com.google.code.gson:gson:2.8.9")

}
tasks.withType<Jar> {
destinationDirectory = File("D:\\Christian\\DEV\\LocalWerk\\modules")
}


tasks {
compileJava {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.jetbrains.annotations.NotNull


@Singleton
class `CloudNet-Rest-Module` : DriverModule() {

Expand Down Expand Up @@ -51,16 +50,28 @@ class `CloudNet-Rest-Module` : DriverModule() {
}





private fun json(cloudServiceManager: CloudServiceManager): JSONObject {
fun services(cloudServiceManager: CloudServiceManager): JSONObject {
val ser = cloudServiceManager.services()
val thing = JSONObject()
thing.put("", 2)
val servicesArray = JSONArray()

ser.forEach { service ->
val serviceObject = JSONObject()
serviceObject.put("Name", service.name())
val addressObject = JSONObject()
addressObject.put("host", service.address().host)
addressObject.put("port", service.address().port)
serviceObject.put("Address", addressObject)
serviceObject.put("Connected", service.connected())
serviceObject.put("LifeCycle", service.lifeCycle())
serviceObject.put("CreationTime", service.creationTime())
serviceObject.put("ConnectedTime", service.connectedTime())
servicesArray.put(serviceObject)
}

val result = JSONObject()
result.put("services", servicesArray)

return thing
return result
}

private fun main(@NotNull cloudServiceManager: CloudServiceManager,
Expand All @@ -84,15 +95,12 @@ class `CloudNet-Rest-Module` : DriverModule() {
call.respondText("Welcome to my Rest API!")
}
get("/services") {
val services = cloudServiceManager.services()

val jsonObject = serviceInfoSnapshot.toJson()
println(jsonObject.toString(4))



//val json = json(cloudServiceManager)
//println(json.toString())
val services = services(cloudServiceManager)
call.respondText(
services.toString(4)
.replace("[", "")
.replace("]", "")
)
}

get("/services/{service}") {
Expand Down
Loading

0 comments on commit 113c33d

Please sign in to comment.