mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-07 08:41:10 +08:00
✨ Feature(server): add http server for uploading images by a http request
port 37766
This commit is contained in:
20
src/main/server/router.ts
Normal file
20
src/main/server/router.ts
Normal 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()
|
||||
Reference in New Issue
Block a user