{"size": 738, "ext": "js", "max_stars_repo_path": "examples/file-upload/index.js", "max_stars_repo_name": "Naitron-oss/Server-Hoster-1", "max_stars_repo_stars_event_min_datetime": "2017-01-27T00:57:41.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T08:59:23.000Z", "max_issues_repo_path": "examples/file-upload/index.js", "max_issues_repo_name": "Naitron-oss/Server-Hoster-1", "max_issues_repo_issues_event_min_datetime": "2017-01-26T23:36:19.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-18T04:24:02.000Z", "max_forks_repo_path": "examples/file-upload/index.js", "max_forks_repo_name": "Naitron-oss/Server-Hoster-1", "max_forks_repo_forks_event_min_datetime": "2017-01-21T14:40:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-28T18:25:46.000Z"}
{"max_stars_count": 3798, "max_issues_count": 138, "max_forks_count": 215, "avg_line_length": 25.4482758621, "max_line_length": 70, "alphanum_fraction": 0.5731707317}
const server = require("../../server");
const { get, post } = server.router;

const form = `
  <!DOCTYPE html>
  <html lang="en">
    <head><meta charset="UTF-8"><title>File Upload Demo</title></head>
    <body>
      <form action="/" method="POST" enctype='multipart/form-data'>
        <input type="text" name="name" required />
        <input type="file" name="picture" required />
        <button>Send</button>
      </form>
    </body>
  </html>
`;

server(
  { security: { csrf: false } },
  get("/", () => form),
  post("/", (ctx) => {
    // Here is your file, "picture" as in name="picture" in the form:
    console.log(ctx.files.picture);
    console.log("Path:", ctx.files.picture.path);

    return ctx.files.picture;
  })
);
