Skip to content

Instantly share code, notes, and snippets.

@nhunzaker
Created February 19, 2012 21:42
Show Gist options
  • Save nhunzaker/1865970 to your computer and use it in GitHub Desktop.
Save nhunzaker/1865970 to your computer and use it in GitHub Desktop.
Iterating over a collection in plates
{
location: [ {
_id: '51a93bf0caf3b609bc00b6eef300097c',
ctime: 1329683491400,
mtime: 1329683491400,
name: 'Dos Perros',
address: '200 N. Mangum Durham, NC 27701',
geolocation: [ 35.998389, -78.899839 ],
pros: [],
cons: [],
resource: 'Restaurant',
_rev: '1-2dc9d0e6e8c7d1889264284730bdddb9' },
{ _id: '51a93bf0caf3b609bc00b6eef3001186',
ctime: 1329686254253,
mtime: 1329686254253,
name: 'Bull City Burger and Brewery',
address: '107 East Parrish Street Durham, NC 27701',
geolocation: [ 35.995855, -78.899946 ],
pros: [],
cons: [],
resource: 'Restaurant',
_rev: '1-b53f8afac22e87810024a87f515a0038' },
{ _id: '51a93bf0caf3b609bc00b6eef300269f',
ctime: 1329686454704,
mtime: 1329686454704,
name: 'Chipotle Mexican Grill - Duke Medical',
address: '2609 Erwin Road, Durham, NC',
geolocation: [ 36.011322, -78.944857 ],
pros: [],
cons: [],
resource: 'Restaurant',
_rev: '1-9d5a72dd653c0f3703d61d19f550b90d' }
]
}
<ul>
<li class="location">
<strong class="name">No data found</strong>:
<span class="address"></span>
<span class="geolocation"></span>
</li>
</ul>
<ul>
<li class="location">
{"_id":"51a93bf0caf3b609bc00b6eef300097c","ctime":1329683491400,"mtime":1329683491400,"name":"Dos Perros","address":"200 N. Mangum Durham, NC 27701","geolocation":[35.998389,-78.899839],"pros":[],"cons":[],"resource":"Restaurant","_rev":"1-2dc9d0e6e8c7d1889264284730bdddb9"},
{"_id":"51a93bf0caf3b609bc00b6eef3001186","ctime":1329686254253,"mtime":1329686254253,"name":"Bull City Burger and Brewery","address":"107 East Parrish Street Durham, NC 27701","geolocation":[35.995855,-78.899946],"pros":[],"cons":[],"resource":"Restaurant","_rev":"1-b53f8afac22e87810024a87f515a0038"},
{"_id":"51a93bf0caf3b609bc00b6eef300269f","ctime":1329686454704,"mtime":1329686454704,"name":"Chipotle Mexican Grill - Duke Medical","address":"2609 Erwin Road, Durham, NC","geolocation":[36.011322,-78.944857],"pros":[],"cons":[],"resource":"Restaurant","_rev":"1-9d5a72dd653c0f3703d61d19f550b90d"}
</li>
</ul>
fs.readFile("list.html", function(err, content) {
self.res.writeHead(200, { 'Content-Type': 'text/html' });
self.res.end(
Plates.bind(content.toString(), { location: docs });
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment