Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Example on creating a basic database driven site, potentially in the docs #54

c2200b opened this Issue Apr 18, 2012 · 2 comments


None yet
3 participants

c2200b commented Apr 18, 2012

I want to create a very basic webpage which lists all the items in a database with links to view individual item pages, and I'm not sure how to do this with flatiron. Would someone mind explaining how to do this? Is this the appropriate location to ask this question? Thanks

You'll need a database module (there are modules available for just about every database) to interface with the database holding your items.

For displaying the individual items, you could look into the docs for Director (a routing module) and Plates (a templating module).

The code might look something like:

app.router.get('/items/:id', function() {
  var item = database.find(id); //database.find(id) is pseudocode - depends on your database module
  var html = "<div id='item_name'></div><div id='item_info'></div>";
  var data = {
    "item_name": item.name
    , "item_info": item.info
  var output = plates.bind(html, data);

None of this code is tested, but you should be able to get the general idea. The item index page could be implemented similarly.


pksunkara commented Jun 9, 2012

Duplicate of #5

@pksunkara pksunkara closed this Jun 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment