Skip to content

Instantly share code, notes, and snippets.

View temmyjay001's full-sized avatar
🎯
Focusing

Solomon Ajayi temmyjay001

🎯
Focusing
  • Nigeria
View GitHub Profile
@temmyjay001
temmyjay001 / currencies-with-flags.json
Created March 13, 2024 08:44 — forked from ibrahimhajjaj/currencies-with-flags.json
Currencies json that contains currency flag as image data, currency codes, currency name, currency base country name, currency base country code.
[
{
"code": "AED",
"name": "UAE Dirham",
"country": "United Arab Emirates",
"countryCode": "AE",
"flag": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAG5SURBVHja7JdLihRBEEBfVqUU6rQNggiCFxA8gswFRNy49gAeQdx4G8HbuHDvRkRUnKxPZ2dGhous6Y9TtavPZmITtYggXsWPSKOqrCkFK8stgAFKoOr1kiKAt8CD76/f/KYYj//u7bPpU28Mn199eGiBLabg7uWLUePLp08mB/j66xvA1gKVSkK9J/29guuxNCZrVX60905qZlD0xvd5XbPvmN22uo+XCFDZXI2Idjt0txuk9TFM+ve7Yk9MAkAPIKSuI3XdoEMX/aQAd4qSfYpHAI0RbVt0FGA/KYAtyvMMaBTUObRpBh2a0E3cgspewkkJQkDqGm3bQfNPL9/PtIQ+cmjC5OqbTaj9qppRcglCAFej3h9H8P9xnBUgCtRNBllYDj0QmxbWAkgxggiktFjg60PosAeMJnQtAIkRq7poBlIfK5cgRBQdzYC1dtLgVVVRluUJgEQo7XH0RminlBDCKUDK99AIwByXs4gcb0JJafaFc7aCjTlktQBIqpiVAPIYas5AcXEx6LCRzaxjKAn4465GjZ1zs13GBngMPAceLbyFfwJfTP8m2PR6SfGAM7eP07UB/g0Aw73uXdMbeJMAAAAASUVORK5CYII="
},
{
"code": "AFN",
@temmyjay001
temmyjay001 / countries.json
Created March 13, 2024 08:43 — forked from amitjambusaria/countries.json
Countries JSON with region, flag, currency and capital
[
{
"name": "Afghanistan",
"code": "AF",
"capital": "Kabul",
"region": "AS",
"currency": {
"code": "AFN",
"name": "Afghan afghani",
"symbol": "؋"
import * as expressive from "https://raw.githubusercontent.com/NMathar/deno-express/master/mod.ts";
import {
getProducts,
getProduct,
addProduct,
updateProduct,
deleteProduct,
} from "./controllers/products.ts";
(async () => {
import { v4 } from "http://deno.land/std/uuid/mod.ts";
import { Product } from "../types/types.ts";
let products: Product[] = [
{
id: "1",
name: "Product 1",
description: "This is product 1",
price: 18.89,
},
{
const deleteProduct = async (request: any, response: any) => {
const id_param = await request.params.id;
products = products.filter((p) => p.id !== id_param);
response.json({
error: false,
message: "Product Deleted",
data: products,
});
};
const updateProduct = async (request: any, response: any) => {
const id_param = await request.params.id;
const data = await request.data;
const product: Product | undefined = products.find((p) => p.id === id_param);
if (product) {
const updateData: {
name?: string;
description?: string;
price?: number;
const addProduct = async (request: any, response: any) => {
// console.log(await request.data);
if (!request.data) {
response.status = 400;
response.json({
error: true,
message: "No data",
});
} else {
const product: Product = await request.data;
const getProducts = async (request: any, response: any) => {
await response.json({
error: false,
data: products,
});
};
const getProduct = async (request: any, response: any) => {
console.log(request.params);
const product: Product | undefined = products.find(
(p) => p.id === request.params.id
);
if (product) {
await response.json({
error: false,
data: product,
});
import { v4 } from "http://deno.land/std/uuid/mod.ts";
import { Product } from "../types/types.ts";
let products: Product[] = [
{
id: "1",
name: "Scott Bike",
description: "scott's products",
price: 18.89,
},
{