File tree Expand file tree Collapse file tree 2 files changed +20
-20
lines changed Expand file tree Collapse file tree 2 files changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -2,28 +2,9 @@ const http = require('http');
22const url = require ( 'url' ) ;
33const fs = require ( 'fs' ) ;
44const path = require ( 'path' ) ;
5+ const mimeType = require ( './modules/mimeType' ) ;
56const port = 9000 ;
67
7- // maps file extention to MIME types
8- // full list can be found here: https://www.freeformatter.com/mime-types-list.html
9- const mimeType = {
10- '.ico' : 'image/x-icon' ,
11- '.html' : 'text/html' ,
12- '.js' : 'text/javascript' ,
13- '.json' : 'application/json' ,
14- '.css' : 'text/css' ,
15- '.png' : 'image/png' ,
16- '.jpg' : 'image/jpeg' ,
17- '.wav' : 'audio/wav' ,
18- '.mp3' : 'audio/mpeg' ,
19- '.svg' : 'image/svg+xml' ,
20- '.pdf' : 'application/pdf' ,
21- '.zip' : 'application/zip' ,
22- '.doc' : 'application/msword' ,
23- '.eot' : 'application/vnd.ms-fontobject' ,
24- '.ttf' : 'application/x-font-ttf' ,
25- } ;
26-
278http
289 . createServer ( function ( req , res ) {
2910 console . log ( `${ req . method } ${ req . url } ` ) ;
Original file line number Diff line number Diff line change 1+ // maps file extention to MIME types
2+ // full list can be found here: https://www.freeformatter.com/mime-types-list.html
3+ module . exports = mimeType = {
4+ '.ico' : 'image/x-icon' ,
5+ '.html' : 'text/html' ,
6+ '.js' : 'text/javascript' ,
7+ '.json' : 'application/json' ,
8+ '.css' : 'text/css' ,
9+ '.png' : 'image/png' ,
10+ '.jpg' : 'image/jpeg' ,
11+ '.wav' : 'audio/wav' ,
12+ '.mp3' : 'audio/mpeg' ,
13+ '.svg' : 'image/svg+xml' ,
14+ '.pdf' : 'application/pdf' ,
15+ '.zip' : 'application/zip' ,
16+ '.doc' : 'application/msword' ,
17+ '.eot' : 'application/vnd.ms-fontobject' ,
18+ '.ttf' : 'application/x-font-ttf' ,
19+ } ;
You can’t perform that action at this time.
0 commit comments