-
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.
Browse files
Browse the repository at this point in the history
…ple for express in examples/express. And sporting new logo by @KevinKirchner
- Loading branch information
Showing
13 changed files
with
191 additions
and
52 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 |
---|---|---|
|
@@ -70,3 +70,9 @@ Laura Doktorova @olado | |
|
||
## License | ||
doT is licensed under the MIT License. (See LICENSE-DOT) | ||
|
||
<p align="center"> | ||
<img src="http://olado.github.io/doT/[email protected]" alt="logo by Kevin Kirchner"/> | ||
</p> | ||
|
||
|
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
require("./lib/app"); |
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,25 @@ | ||
require("dot").process({ | ||
global: "_page.render" | ||
, destination: __dirname + "/render/" | ||
, path: (__dirname + "/../templates") | ||
}); | ||
|
||
var express = require('express') | ||
, http = require('http') | ||
, app = express() | ||
, render = require('./render') | ||
; | ||
|
||
app.get('/', function(req, res){ | ||
res.send(render.dashboard({text:"Good morning!"})); | ||
}); | ||
|
||
app.use(function(err, req, res, next) { | ||
console.error(err.stack); | ||
res.status(500).send('Something broke!'); | ||
}); | ||
|
||
var httpServer = http.createServer(app); | ||
httpServer.listen(3000, function() { | ||
console.log('Listening on port %d', httpServer.address().port); | ||
}); |
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,18 @@ | ||
var path = require('path') | ||
, fs = require('fs'); | ||
|
||
function req(name) { | ||
var module = require("./" + name); | ||
delete exports[name]; | ||
return exports[name] = module; | ||
} | ||
|
||
fs.readdirSync(__dirname).forEach(function(file) { | ||
if ((file === 'index.js') || (file[0] === '_')) { return; } | ||
var ext = path.extname(file); | ||
var stats = fs.statSync(__dirname + '/' + file); | ||
if (stats.isFile() && !(ext in require.extensions)) { return; } | ||
var basename = path.basename(file, '.js'); | ||
exports.__defineGetter__(basename, function(){ return req(basename); }); | ||
}); | ||
|
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,10 @@ | ||
{ | ||
"name": "dot-express-example", | ||
"description": "doT express example", | ||
"version": "0.0.1", | ||
"private": true, | ||
"dependencies": { | ||
"express": "4.x", | ||
"dot": "*" | ||
} | ||
} |
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,5 @@ | ||
{{##def.test: | ||
{{=it.text}} | ||
#}} | ||
|
||
{{#def.test}} |
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,34 @@ | ||
<html> | ||
<body> | ||
<div>Signin</div> | ||
<form action="/login" method="post"> | ||
<div> | ||
<label>Username:</label> | ||
<input type="text" name="username" /> | ||
<br/> | ||
</div> | ||
<div> | ||
<label>Password:</label> | ||
<input type="password" name="password" /> | ||
</div> | ||
<div> | ||
<input type="submit" value="Sign in" /> | ||
</div> | ||
</form> | ||
<div>Signup</div> | ||
<form action="/signup" method="post"> | ||
<div> | ||
<label>Username:</label> | ||
<input type="text" name="username" /> | ||
<br/> | ||
</div> | ||
<div> | ||
<label>Password:</label> | ||
<input type="password" name="password" /> | ||
</div> | ||
<div> | ||
<input type="submit" value="Sign up" /> | ||
</div> | ||
</form> | ||
</body> | ||
</html> |
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
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
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