- Router;
- Navigation;
- Handle wrong path (404 not found);
- Animation during loading;
- Button hover effects;
- Input focus effects;
- Using form;
- Async get request;
- Handle wrong input;
- Output array to grid;
- Layout for mobile;
- Sort array with using library Lodash;
- Using styles;
- Find crypto;
- List crypto;
- Footer with information about using api and horizontal scroll;
- Horizontal scroll in page List crypto for mobile devices;
- Using api;
- CORS in backend;
- Caching with PostgreSQL.
- ReactJS;
NodeJSDeno;- HTML;
- JS, Typescript;
- CSS, CSS3;
- Libraries: Bootstrap, React-Bootstrap, React-Router-Dom, React-Redux, Redux, Styled Components, Redux-Devtools-Extension, Redux-Thunk, Material-UI, Lodash, Supabase
Express; - Backend: Supabase;
- Caching: PostgreSQL (built into Supabase);
- Test library Jest;
- Method: Mobile First;
- Api: coingecko-api.
Supabase has Edge Functions and PostgreSQL and uses Deno. Backend code was written in Edge Functions editor. Backend uses caching with PostgreSQL: holds cache in 2 minutes and deletes cache. If backend doesn't hold cache, backend uses request to API. Backend uses CORS:
const origin = req.headers.get('origin');
if (origin && origin !== mySite)
{
return jsonResponse('FORBIDDEN 403', '*', 403);
}const jsonResponse = (data: unknown, site: string, status = 200) =>
{
const corsHeaders =
{
'Access-Control-Allow-Origin': `${site}`,
'Content-Type': 'application/json; charset=utf-8',
};
return new Response(JSON.stringify(data), {
status,
headers: corsHeaders,
});
};Code of creating table is in table.sql. Table was created without RLS (Row Level Security).
Code of deletion data is in delete.sql. This code is function (RPC) in Supabase and deletes data if data were created >2 minutes before execution. Deletion data is triggered by this code:
if (new Date(Date.now()).getTime() - new Date(data.created_at).getTime() > CACHE_TTL)
{
const { error } = await supabase.rpc('delete');
if (error)
{
console.log('Error: ' + error.message);
}
}URL .