Skip to content

Instantly share code, notes, and snippets.

View YodasWs's full-sized avatar

Sam Grundman YodasWs

  • Charlotte, NC
View GitHub Profile
@YodasWs
YodasWs / server.js
Last active September 9, 2016 18:28
A simplistic NodeJS HTTP server
var http = require('http'),
path = require('path'),
fs = require('fs'),
optional = require('optional'),
sass = optional('node-sass')
http.createServer(function(req, res) {
var fileName = req.url == '/' ? '/index.html' : decodeURIComponent(req.url),
filePath = __dirname + '/www' + fileName,
ext = fileName.lastIndexOf('.') > -1 ? fileName.substring(fileName.lastIndexOf('.') + 1) : 'html'