{"size": 469, "ext": "js", "max_stars_repo_path": ".scully/plugins/samvloeberghs-posts.js", "max_stars_repo_name": "BlindDespair/kwerri-oss", "max_stars_repo_stars_event_min_datetime": "2019-03-01T10:53:00.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-03T17:38:48.000Z", "max_issues_repo_path": ".scully/plugins/samvloeberghs-posts.js", "max_issues_repo_name": "BlindDespair/kwerri-oss", "max_issues_repo_issues_event_min_datetime": "2019-03-21T21:02:57.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T08:15:47.000Z", "max_forks_repo_path": ".scully/plugins/samvloeberghs-posts.js", "max_forks_repo_name": "BlindDespair/kwerri-oss", "max_forks_repo_forks_event_min_datetime": "2020-01-21T06:05:03.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-02T15:30:33.000Z"}
{"max_stars_count": 55, "max_issues_count": 58, "max_forks_count": 18, "avg_line_length": 22.3333333333, "max_line_length": 46, "alphanum_fraction": 0.6780383795}
const {
  httpGetJson, registerPlugin, routeSplit
} = require('@scullyio/scully');

const Posts = 'posts';

const postsPlugin = async (route, config) => {
  const list = await httpGetJson(config.url);
  const { createPath } = routeSplit(route);
  const handledRoutes = [];
  for (let item of list) {
    handledRoutes.push({
      route: createPath(item.slug)
    });
  }
  return handledRoutes;
};

registerPlugin('router', Posts, postsPlugin);
exports.Posts = Posts;
