poet-autoroutedeprecated

Adds routes for all files in ./routes to a Poet app.

Usage no npm install needed!

<script type="module">
  import poetAutoroute from 'https://cdn.skypack.dev/poet-autoroute';
</script>

README

poet-autoroute

Adds routes for all files in ./routes to a Poet app.

Usage

Requiring poet-autoroute instead of poet and setting autoRoute: true in Poet's options tells it to add routes for all files in ./routes.

var
  express = require('express'),
  app = express(),
  Poet = require('poet-autoroute');

var poet = Poet(app, {
  posts: './_posts/',
  postsPerPage: 5,
  metaFormat: 'yaml',
  routes: {
    '/posts/:post': 'post',
    '/pages/:page': 'page',
    '/tags/:tag': 'tag',
    '/categories/:category': 'category'
  },
  autoRoute: true
})