themes im backend etzala

This commit is contained in:
Flummi
2021-04-17 19:55:25 +02:00
parent 65454961ce
commit 97519de05b
7 changed files with 63 additions and 23 deletions

View File

@@ -37,6 +37,14 @@ import router from "./inc/router.mjs";
"Cache-Control": "no-cache, public",
"Location": target
}).end();
req.cookies = {};
if(req.headers.cookie) {
req.headers.cookie.split("; ").forEach(c => {
const parts = c.split('=');
req.cookies[parts.shift().trim()] = decodeURI(parts.join('='));
});
}
!(r = router.routes.getRoute(req.url.pathname, req.method)) ? res.writeHead(404).end(`404 - ${req.url.pathname}`) : await r(req, res);
console.log([