type Base64String = string;
type RequestBody = {
url: string;
};
type RequestBody = ResponseBodyData | ResponseBodyError;
type ResponseBodyData = {
data: {
image: Base64String;
title: string;
description: string;
url: string;
};
error: null;
};
type ResponseBodyError = {
data: null;
error: "Error in runtime";
};
curl http://localhost:3030/ \ -X POST \ -d '{"url":"https://lichess.org/"}' \ -H "Content-Type: application/json"
{
"data": {
"image": "data:image/png;base64,iVBO....uCC"
"title": string;
"description": string;
"url": string;
},
"error": null;
}
- Run "npm install", "yarn install" or "pnpm install"
- Copy .env.example to .env
- Edit .env
- Run "npm run dev"
Note: Please add to .gitignore the files added by npm, yarn or pnpm