Referance code
import React from 'react';
// SIMPLE SERVER
/* import {serve} from 'https://deno.land/std/http/server.ts';
const address = "127.0.0.1:8000" ;
console.log(`Simple server is running on ${address}`);
for await (const req of serve(address)){
req.respond({});
}
*/
/*
// https://deno.land/manual/runtime/program_lifecycle
// Deno supports browser compatible lifecycle events
window.onload = (event: Event ): void =>{
console.log("window is on load and event type is = " + event.type);
}
*/
/*
import {currentDayOfYear} from "https://deno.land/std/datetime/mod.ts";
console.log(currentDayOfYear());
*/
/*
// https://doc.deno.land/https/github.com/denoland/deno/releases/latest/download/lib.deno.d.ts#Deno.version
// CHECK VERSION
console.log(Deno.version);
*/
/*
// MAKE DIRECTORY
// https://doc.deno.land/https/github.com/denoland/deno/releases/latest/download/lib.deno.d.ts#Deno.mkdir
await Deno.mkdir("new folder");
*/
/*
// WRITE FILE INSIDE OUR DIR
// https://doc.deno.land/https/github.com/denoland/deno/releases/latest/download/lib.deno.d.ts#Deno.writeFile
const encoder = new TextEncoder();
const data = encoder.encode("Hello world\n");
Deno.writeFile("new\ folder/hello1.txt", data); // overwrite "hello1.txt" or create it
*/
/*
// READ FILE
// https://doc.deno.land/https/github.com/denoland/deno/releases/latest/download/lib.deno.d.ts#Deno.readFile
const decoder = new TextDecoder('utf-8');
const data = await Deno.readFile('./new\ folder/hello1.txt');
console.log(decoder.decode(data));
*/
/*
// ASSERTION
import {assertEquals} from "https://deno.land/std/testing/asserts.ts";
Deno.test("Hello World", ()=>{
let x = 2+5;
assertEquals(x, 7, "Assert test")
});
*/
No comments: