{"size": 431, "ext": "js", "max_stars_repo_path": "src/routes/api/[slug].json.js", "max_stars_repo_name": "ShZh-websites/my-personal-diaries", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/routes/api/[slug].json.js", "max_issues_repo_name": "ShZh-websites/my-personal-diaries", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/routes/api/[slug].json.js", "max_forks_repo_name": "ShZh-websites/my-personal-diaries", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.9444444444, "max_line_length": 50, "alphanum_fraction": 0.6194895592}
import * as path from 'path';
import { promises as fs } from 'fs';
import { getPostInfo } from '../../utils/file.js';

export async function get({ params }) {
  const { slug } = params;
  const fileName = slug + '.md';
  const pathName = path.join('posts', fileName);
  const [postInfo, post] = await Promise.all([
    getPostInfo(fileName),
    fs.readFile(pathName, 'utf-8')
  ]);

  return {
    body: { post, postInfo }
  };
}
