[+] Create api list

This commit is contained in:
Hykilpikonna
2021-01-12 13:47:00 -05:00
parent 7017a73a9a
commit 9aca5480a8
+17 -2
View File
@@ -6,10 +6,25 @@
import Foundation
let baseUrl = "http://localhost:8080/api/" // TODO: Production settings
/// Base URL of the HTTP server
let baseUrl = "http://localhost:8080/api" // TODO: Production settings
/// API class
struct API<T>
{
let loc: String
}
/// Class to store static API endpoints
class APIs
{
static let register = API<User>(loc: "/user/register")
private init() {}
}
/// Build a URL with the node path and params
func buildUrl(_ node: String, _ params: [String: String]?) -> URL
func url(_ node: String, _ params: [String: String]? = [:]) -> URL
{
var url = URLComponents(string: baseUrl + node)
if let params = params