forked from mape/node-express-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6a8e57e
Showing
12 changed files
with
6,624 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2009 Mathias Pettersson, [email protected] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# node-express-boilerplate | ||
|
||
A boilerplate used to quickly get minor projects going. With less configuration. | ||
|
||
## Requires | ||
npm install connect | ||
npm install connect-assetmanager | ||
npm install connect-assetmanager-handlers | ||
npm install express |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
var connect = require('connect'); | ||
var assetManager = require('connect-assetmanager'); | ||
var assetHandler = require('connect-assetmanager-handlers'); | ||
var express = require('express'); | ||
|
||
process.title = 'node-express-boilerplate'; | ||
process.addListener('uncaughtException', function (err, stack) | ||
{ | ||
console.log('Caught exception: ' + err); | ||
console.log(err.stack.split('\n')); | ||
}); | ||
|
||
var assets = assetManager({ | ||
'js': { | ||
'route': /\/static\/js\/[0-9]+\/.*\.js/ | ||
, 'path': './public/js/' | ||
, 'dataType': 'js' | ||
, 'files': [ | ||
'jquery.js' | ||
, 'jquery.client.js' | ||
, 'jquery.reload.js' | ||
] | ||
, 'preManipulate': { | ||
'^': [] | ||
} | ||
, 'postManipulate': { | ||
'^': [ | ||
assetHandler.uglifyJsOptimize | ||
] | ||
} | ||
}, 'css': { | ||
'route': /\/static\/css\/[0-9]+\/.*\.css/ | ||
, 'path': './public/css/' | ||
, 'dataType': 'css' | ||
, 'files': [ | ||
'reset.css' | ||
, 'client.css' | ||
] | ||
, 'preManipulate': { | ||
/*'MSIE': [ | ||
assetHandler.yuiCssOptimize | ||
, assetHandler.fixVendorPrefixes | ||
, assetHandler.fixGradients | ||
, assetHandler.stripDataUrlsPrefix | ||
, assetHandler.fixFloatDoubleMargin | ||
] | ||
, */ | ||
'^': [ | ||
assetHandler.fixVendorPrefixes | ||
, assetHandler.fixGradients | ||
, assetHandler.replaceImageRefToBase64(__dirname + '/public') | ||
] | ||
} | ||
, 'postManipulate': { | ||
'^': [ | ||
function (file, path, index, isLast, callback) { | ||
// Notifies the browser to refresh the CSS. | ||
// This enables coupled with jquery.reload.js | ||
// enables live CSS editing without reload. | ||
callback(file); | ||
lastChangedCss = Date.now(); | ||
} | ||
] | ||
} | ||
} | ||
}); | ||
|
||
var app = module.exports = express.createServer(); | ||
|
||
app.configure(function() { | ||
app.set('view engine', 'ejs'); | ||
app.set('views', __dirname + '/views'); | ||
}); | ||
|
||
app.configure(function() { | ||
app.use(connect.conditionalGet()); | ||
app.use(connect.gzip()); | ||
app.use(connect.bodyDecoder()); | ||
app.use(connect.logger()); | ||
app.use(assets); | ||
app.use(connect.staticProvider(__dirname + '/public')); | ||
}); | ||
|
||
app.configure('development', function() { | ||
app.use(connect.errorHandler({ dumpExceptions: true, showStack: true })); | ||
}); | ||
|
||
app.dynamicHelpers({ | ||
cacheTimeStamps: function(req, res) { | ||
return assets.cacheTimestamps; | ||
} | ||
}); | ||
|
||
app.get('/', function(req, res) { | ||
res.render('index', { | ||
locals: { | ||
'date': new Date().toString() | ||
} | ||
}); | ||
}); | ||
|
||
app.post('/', function(req, res) { | ||
console.log(req.body); | ||
res.send('post'); | ||
}); | ||
|
||
var lastChangedCss = 0; | ||
app.get('/reload/', function(req, res) { | ||
var reloadCss = lastChangedCss; | ||
(function reload () { | ||
setTimeout(function () { | ||
if ( reloadCss < lastChangedCss) { | ||
res.send('reload'); | ||
reloadCss = lastChangedCss; | ||
} else { | ||
reload(); | ||
} | ||
}, 100); | ||
})(); | ||
}); | ||
|
||
app.listen(1343); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
::-moz-selection { | ||
background-color: rgba(0,0,0,0.6); | ||
} | ||
|
||
::selection { | ||
background-color: rgba(0,0,0,0.6); | ||
} | ||
html | ||
{ | ||
gradient: #ddd_#ccc; | ||
height: 100%; | ||
} | ||
body | ||
{ | ||
height: 100%; | ||
-vendor-box-sizing: border-box; | ||
background: data-url(/img/bg.png); | ||
color: #222; | ||
margin: 0; | ||
font: 12px 'helvetica neue', helvetica, arial, sans-serif; | ||
text-rendering: optimizeLegibility; | ||
} | ||
a | ||
{ | ||
color: #000; | ||
text-decoration: none; | ||
outline: none; | ||
} | ||
a:hover | ||
{ | ||
text-decoration: underline; | ||
} | ||
h1,h2,h3,h4,h5 | ||
{ | ||
font-weight: bold; | ||
-vendor-text-shadow: 1px 1px 0 rgba(255,255,255,0.8), 0 0 15px rgba(0,0,0,0.4); | ||
} | ||
h1 | ||
{ | ||
font-size: 30px; | ||
} | ||
#page-container | ||
{ | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
margin: -32px 0 0 -330px; | ||
border: 1px rgba(255,255,255,0.3) solid; | ||
gradient: rgba(255,255,255,1)_rgba(255,255,255,0.1); | ||
-vendor-box-shadow: 0px 0px 15px rgba(0,0,0,0.3), 0px 0px 10px rgba(0,0,0,0.2) inset; | ||
padding: 12px 15px; | ||
-vendor-border-radius: 15px; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* | ||
Copyright (c) 2010, Yahoo! Inc. All rights reserved. | ||
Code licensed under the BSD License: | ||
http://developer.yahoo.com/yui/license.html | ||
version: 2.8.1 | ||
*/ | ||
/** | ||
* YUI Reset | ||
* @module reset | ||
* @namespace | ||
* @requires | ||
*/ | ||
html { | ||
color: #000; | ||
background: #FFF; | ||
} | ||
|
||
body, | ||
div, | ||
dl, | ||
dt, | ||
dd, | ||
ul, | ||
ol, | ||
li, | ||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
h5, | ||
h6, | ||
pre, | ||
code, | ||
form, | ||
fieldset, | ||
legend, | ||
input, | ||
button, | ||
textarea, | ||
p, | ||
blockquote, | ||
th, | ||
td { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
table { | ||
border-collapse: collapse; | ||
border-spacing: 0; | ||
} | ||
|
||
fieldset, | ||
img { | ||
border: 0; | ||
} | ||
|
||
address, | ||
caption, | ||
cite, | ||
code, | ||
dfn, | ||
em, | ||
strong, | ||
th, | ||
var, | ||
optgroup { | ||
font-style: inherit; | ||
font-weight: inherit; | ||
} | ||
|
||
del, | ||
ins { | ||
text-decoration: none; | ||
} | ||
|
||
li { | ||
list-style: none; | ||
} | ||
|
||
caption, | ||
th { | ||
text-align: left; | ||
} | ||
|
||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
h5, | ||
h6 { | ||
font-size: 100%; | ||
font-weight: normal; | ||
} | ||
|
||
q:before, | ||
q:after { | ||
content: ''; | ||
} | ||
|
||
abbr, | ||
acronym { | ||
border: 0; | ||
font-variant: normal; | ||
} | ||
|
||
sup { | ||
vertical-align: baseline; | ||
} | ||
|
||
sub { | ||
vertical-align: baseline; | ||
} | ||
|
||
legend { | ||
color: #000; | ||
} | ||
|
||
input, | ||
button, | ||
textarea, | ||
select, | ||
optgroup, | ||
option { | ||
font-family: inherit; | ||
font-size: inherit; | ||
font-style: inherit; | ||
font-weight: inherit; | ||
} | ||
|
||
input, | ||
button, | ||
textarea, | ||
select { | ||
*font-size: 100%; | ||
} | ||
|
||
|
||
|
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(function ($) { | ||
$('body').removeClass('nojs'); | ||
setInterval(function () { | ||
$('h1').text(new Date().toString()); | ||
}, 500); | ||
})(jQuery.noConflict()); |
Oops, something went wrong.