15 lines
421 B
JavaScript
15 lines
421 B
JavaScript
|
import http from "http";
|
||
|
import url from "url";
|
||
|
|
||
|
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);
|