Skip to content

Commit

Permalink
Add basic JS-QR fiddle for #1
Browse files Browse the repository at this point in the history
  • Loading branch information
FokkeZB committed Jun 15, 2015
1 parent 210ed83 commit 80cfaba
Show file tree
Hide file tree
Showing 426 changed files with 86,307 additions and 5 deletions.
Empty file added lib/fiddle.js
Empty file.
11 changes: 6 additions & 5 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ var server = http.createServer(function (req, res) {
// without commit gist URLs cache
var samplesUrl = CFG.SAMPLES_URL + '?' + Date.now();

res.statusCode = 302;
res.setHeader('Location', samplesUrl);
return utils.redirect(res, samplesUrl);

return res.end(res.statusCode + ' Found ' + samplesUrl);
} else if (parsedUrl.pathname === '/') {
return utils.redirect(res, '/fiddle');

} else {
res.statusCode = 404;
return res.end(res.statusCode + ' Not Found');
return send(req, parsedUrl.pathname, {
root: path.resolve(__dirname, '..', 'public')
}).pipe(res);
}

}).listen(CFG.PORT);
Expand Down
7 changes: 7 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,10 @@ Utils.normalizePlatformFolder = function normalizePlatformFolder(folder) {

return folder;
};

Utils.redirect = function redirect(res, url) {
res.statusCode = 302;
res.setHeader('Location', url);

return res.end(res.statusCode + ' Found ' + url);
};
8 changes: 8 additions & 0 deletions public/codemirror/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.txt text
*.js text
*.html text
*.md text
*.json text
*.yml text
*.css text
*.svg text
8 changes: 8 additions & 0 deletions public/codemirror/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/node_modules
/npm-debug.log
/test*.html
.tern-*
*~
*.swp
.idea
*.iml
3 changes: 3 additions & 0 deletions public/codemirror/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- 0.10
Loading

0 comments on commit 80cfaba

Please sign in to comment.