chilts / blogz

Read a directory of files, get a blog data structure.
4 stars 3 forks source link

Decide whether to keep returning a data structure, or an object with useful methods #1

Open chilts opened 10 years ago

chilts commented 10 years ago

See this similar project for how @pushrax does it:

https://github.com/pushrax/node-blog-base

Should we do the same? I'm not sure, but I may experiment on a branch and see how it looks in https://github.com/chilts/connect-blog :)

/cc @alessioalex

alessioalex commented 10 years ago

I think we should add such methods, but in the same time let the user access the posts directly.

Something simple like:

blog = {
  posts: raw_data_here,
  methods: {
  .. all methods here ...
  }
}

Later on someone may want to add extra stuff like http://lunrjs.com/ and this way it's really straight-forward.

pushrax commented 10 years ago

You could create a Blog prototype/class and have a public posts property.