modified: public/css/f0ck.css

new file:   public/js/f0ck.js
	modified:   src/inc/routes/api.mjs
	modified:   src/inc/routes/index.mjs
modified:   src/websrv.mjs
	modified:   views/index.html.tpl
This commit is contained in:
Flummi
2019-04-26 04:19:20 +00:00
parent b9adbffc81
commit c95e0d82f1
6 changed files with 27 additions and 18 deletions

View File

@@ -1,14 +1,20 @@
import http from "http";
import url from "url";
import querystring from "querystring";
import cfg from "../config.json";
// routes
import "./inc/routes/index";
import "./inc/routes/api";
import { routes } from "./inc/router";
http.createServer((req, res, r, uri = url.parse(req.url)) => {
req.url = uri;
req.url.split = uri.pathname.split("/");
req.url.split.shift();
(!(r = routes.getRegex(req.url.pathname, req.method)) ? res.end(`404 - ${req.url.pathname}`) : r(req, res))
}).listen(1499);
http.createServer((req, res, r) => {
req.url = url.parse(req.url.replace(/(?!^.)(\/+)?$/, ''));
req.url.split = req.url.pathname.split("/").slice(1);
req.url.qs = querystring.parse(req.url.query);
console.log(`[${(new Date()).toLocaleTimeString()}] ${req.method} ${req.url.pathname}`);
!(r = routes.getRegex(req.url.pathname, req.method)) ? res.end(`404 - ${req.url.pathname}`) : r(req, res);
}).listen(cfg.websrv.port, () => console.log(`f0ck is listening on port ${cfg.websrv.port}.`));