import { createHandler, StartServer } from "@solidjs/start/server";
import * as fs from "node:fs";
import * as toml from "toml";
import { HTML } from "../@dasig/index";

const config = toml.parse(fs.readFileSync("configs/config.site.toml", "utf8"));
const websiteName = config.website.name;
const websiteDescription = config.website.description;
const author = config.copyright.name;
const font = config.font.name;

export default createHandler(() => (
  <StartServer
    document={({ assets, children, scripts }) => (
      <HTML
        name={websiteName}
        description={websiteDescription}
        author={author}
        children={children}
        assets={assets}
        scripts={scripts}
        font={font}
      />
    )}
  />
));
