node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

connect-dir

Connect-content

This is connect middleware for serving static content from a "content" dir. inspired by kriby and stacey I wanted a way to use the file system as a basic cms.

this middleware attaches the data found in the "content" directory to the req object

it does not however provide any templating logic. express has got that covered

Usage


var app = express()
var cms = require('connect-dir')
 
app.use(cms())
 
app.get('*', function(req, res) {
  var data = req.content
  res.json(data)
})
 
app.listen(process.env.PORT || 3000)