Skip to content

Commit

Permalink
change router importing functions
Browse files Browse the repository at this point in the history
Relates #56
  • Loading branch information
Parissai committed Mar 29, 2018
1 parent 11e956b commit b89dac0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/router.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const handler = require("./handler");
const {handleHome, handleLatest, handleStatic, handleSearch} = require("./handler");

const router = (request, response) => {
const url = request.url;
if (url === "/") {
handler.handleHome(request, response);
handleHome(request, response);
} else if (url === "/latest") {
handler.handleLatest(request, response);
handleLatest(request, response);
} else if (url.indexOf("public") !== -1) {
handler.handleStatic(request, response);
handleStatic(request, response);
} else if (url.startsWith("/search")) {
handler.handleSearch(request, response);
handleSearch(request, response);
} else {
response.writeHead(404, { "Content-Type": "text/html" });
response.end("Page not found");
Expand Down

0 comments on commit b89dac0

Please sign in to comment.