idk
This commit is contained in:
		
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							@@ -124,7 +124,7 @@ export default class Flummpress {
 | 
			
		||||
            res.reply({ code, type: "text/html", body });
 | 
			
		||||
        };
 | 
			
		||||
        res.redirect = (target, code = 302) => {
 | 
			
		||||
            res.writeHead(code, { Location: target });
 | 
			
		||||
            res.writeHead(code, { Location: encodeURI(target) });
 | 
			
		||||
            res.end();
 | 
			
		||||
        };
 | 
			
		||||
        return res;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								dist/router.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								dist/router.js
									
									
									
									
										vendored
									
									
								
							@@ -13,7 +13,6 @@ import Tpl from "./template.js";
 | 
			
		||||
export default class Router {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        this.routes = [];
 | 
			
		||||
        this.routes;
 | 
			
		||||
        this.mimes = new Map();
 | 
			
		||||
    }
 | 
			
		||||
    importRoutesFromPath(p_1) {
 | 
			
		||||
@@ -71,6 +70,7 @@ export default class Router {
 | 
			
		||||
    }
 | 
			
		||||
    use(obj) {
 | 
			
		||||
        if (obj instanceof Router) {
 | 
			
		||||
            this.routes = Object.assign(Object.assign({}, this.routes), obj.routes);
 | 
			
		||||
            this.sortRoutes();
 | 
			
		||||
        }
 | 
			
		||||
        if (obj instanceof Tpl) {
 | 
			
		||||
@@ -102,12 +102,12 @@ export default class Router {
 | 
			
		||||
        return this;
 | 
			
		||||
    }
 | 
			
		||||
    registerRoute(path, method, handler) {
 | 
			
		||||
        const existingRoute = this.routes.find(route => typeof route.path === "string"
 | 
			
		||||
        const route = this.routes.find(route => typeof route.path === "string"
 | 
			
		||||
            ? route.path === path
 | 
			
		||||
            : route.path instanceof RegExp && path instanceof RegExp && route.path.toString() === path.toString());
 | 
			
		||||
        if (existingRoute) {
 | 
			
		||||
            existingRoute.methods[method] = [
 | 
			
		||||
                ...(existingRoute.methods[method] || []),
 | 
			
		||||
        if (route) {
 | 
			
		||||
            route.methods[method] = [
 | 
			
		||||
                ...(route.methods[method] || []),
 | 
			
		||||
                ...handler
 | 
			
		||||
            ];
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user