From 909d75e98a2d27b6d831124effbe8f73ee4ce498 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 13 Mar 2016 17:09:40 -0400 Subject: add guff-stuff static files handler --- src/guff/mime-type.cr | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/guff/mime-type.cr (limited to 'src/guff/mime-type.cr') diff --git a/src/guff/mime-type.cr b/src/guff/mime-type.cr new file mode 100644 index 0000000..992521b --- /dev/null +++ b/src/guff/mime-type.cr @@ -0,0 +1,14 @@ +module Guff::MimeType + TYPES = { + ".js": "text/javascript; charset=utf-8", + ".css": "text/css; charset=utf-8", + ".html": "text/html; charset=utf-8", + ".png": "image/png", + ".jpeg": "image/jpeg", + ".jpg": "image/jpeg", + } + + def self.mime_type(path : String) : String + TYPES[File.extname(path)]? || "application/octet-stream" + end +end -- cgit v1.2.3