Feature(server): add http server for uploading images by a http request

port 37766
This commit is contained in:
Molunerfinn
2019-12-31 23:50:19 +08:00
parent 3fd95725cf
commit c56d4efa79
13 changed files with 558 additions and 54 deletions

20
src/main/server/router.ts Normal file
View File

@@ -0,0 +1,20 @@
class Router {
private router = new Map<string, routeHandler>()
get (url: string, callback: routeHandler): void {
this.router.set(url, callback)
}
post (url: string, callback: routeHandler): void {
this.router.set(url, callback)
}
getHandler (url: string) {
if (this.router.has(url)) {
return this.router.get(url)
} else {
return null
}
}
}
export default new Router()