summaryrefslogtreecommitdiff
path: root/nexus/router/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'nexus/router/api.go')
-rw-r--r--nexus/router/api.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/nexus/router/api.go b/nexus/router/api.go
new file mode 100644
index 0000000..6f8314e
--- /dev/null
+++ b/nexus/router/api.go
@@ -0,0 +1,29 @@
+package router
+
+import (
+ "nexus/api/account"
+ "nexus/api/auth"
+ "nexus/api/characters"
+ "nexus/api/realms"
+ nexusAuth "nexus/utils/auth"
+ "nexus/utils/urls"
+)
+
+func init() {
+ urls.SetNamespace("api")
+
+ urls.Path(urls.Post, "/auth/register", auth.Register, "auth.register")
+ urls.Path(urls.Post, "/auth/login", auth.Login, "auth.login")
+ urls.Path(urls.Post, "/auth/refresh", auth.Refresh, "auth.refresh")
+ urls.Path(urls.Post, "/auth/logout", nexusAuth.APIAuth(auth.Logout), "auth.logout")
+
+ urls.Path(urls.Get, "/account", nexusAuth.APIAuth(account.Show), "account.show")
+ urls.Path(urls.Delete, "/account", nexusAuth.APIAuth(account.Delete), "account.delete")
+
+ urls.Path(urls.Get, "/characters", nexusAuth.APIAuth(characters.Index), "characters.index")
+ urls.Path(urls.Get, "/characters/:id", nexusAuth.APIAuth(characters.Show), "characters.show")
+ urls.Path(urls.Post, "/characters", nexusAuth.APIAuth(characters.Create), "characters.create")
+ urls.Path(urls.Delete, "/characters/:id", nexusAuth.APIAuth(characters.Delete), "characters.delete")
+
+ urls.Path(urls.Get, "/realms", nexusAuth.APIAuth(realms.Index), "realms.index")
+}