importfastro,{Context,HttpRequest}from"@app/mod.ts";const f =newfastro();// set default value for the store
f.store.set("hello","hello world");
f.post("/",(_req:HttpRequest, ctx:Context)=>{// update default value
ctx.store.set("hello","hello world v2");return ctx.send("Helo world",200);},);
f.post("/ttl",(_req:HttpRequest, ctx:Context)=>{// update default value with TTL
ctx.store.set("hello","world",1000);return ctx.send("ttl",200);},);
f.post("/commit",async(_req:HttpRequest, ctx:Context)=>{// save store to githubawait ctx.store.commit();return ctx.send("commit",200);},);
f.get("/",(_req:HttpRequest, ctx:Context)=>{// get the valueconst res = ctx.store.get("hello");returnResponse.json({ value: res });},);
f.post("/destroy",async(_req:HttpRequest, ctx:Context)=>{// destroy fileawait ctx.store.destroy();return ctx.send("destroy",200);},);await f.serve();