Created
January 30, 2020 18:38
-
-
Save LautaroJayat/b6d120ff7e7817c75fd073157c35e730 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ctrl = require('./controllers/controllers'); | |
const app = (req, res) => { | |
const URL = req.url; | |
// What we say when the request method isnt GET | |
if (req.method !== 'GET') { | |
ctrl.forInvalidMethod(req, res); | |
} | |
// Handler to serve index.html | |
if (URL === '/') { | |
ctrl.forIndex(req, res); | |
} | |
// Handler to serve stylesheets | |
if (URL.indexOf('.css') > 0) { | |
ctrl.forCSS(req, res); | |
} | |
// Handle to serve our video | |
if (URL.split('.')[1] === 'mp4') { | |
ctrl.forVideo(req, res); | |
} | |
} | |
module.exports = app; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment