merge: First tutorial + Example (#804)

## Changes:

- /docs is now a Getting Started page with the first tutorial
- basic-example added
This commit is contained in:
João Demenech
2023-04-27 14:55:54 -03:00
committed by GitHub
parent 6d04e2d8c3
commit ad209c8f21
37 changed files with 12453 additions and 32 deletions

View File

@@ -0,0 +1,20 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'
import { promises as fs } from 'fs';
import path from 'path';
export default async function handler(
req: NextApiRequest,
res: NextApiResponse<string>
) {
const contentDir = path.join(process.cwd(), '/content');
const datasets = await fs.readdir(contentDir);
const query = req.query;
const { fileName } = query;
const dataFile = path.join(
process.cwd(),
'/content/' + datasets[0] + '/' + fileName
);
const data = await fs.readFile(dataFile, 'utf8');
res.status(200).send(data)
}