//// "Oak" server
import { Application, Router } from "https://deno.land/x/oak/mod.ts";
//// "React" stuff
// @deno-types="https://deno.land/x/servest/types/react/index.d.ts"
import React from "https://dev.jspm.io/react/index.js";
// @deno-types="https://deno.land/x/servest/types/react-dom/server/index.d.ts"
import ReactDOMServer from "https://dev.jspm.io/react-dom/server.js";
//attemp conversion to a table
const CustomItemList = (props: any) => {
return (
Items
{props.items.length} total
Descritpion |
Amount |
Log ID |
{props.items.map((inItem: any) => {
return (
);
})}
);
};
const CustomItem = (props: any) => {
return (
{props.description} |
{props.amount} |
{props.id} |
|
);
};
/*
const CustomItem = (props: any) => {
return (
Description: {props.description}
Amount: {props.amount}
Key: {props.id}
);
};
*/
export default (inState: any, inPort: number) => {
let app, router;
let state: any;
router = new Router();
router.get("/api/all", (ctx: any) => {
ctx.response.body = JSON.stringify(inState);
});
router.get("/", (ctx: any) => {
ctx.response.body = ReactDOMServer.renderToString(
Welcome!
);
});
app = new Application();
app.use(router.routes());
app.listen({ port: inPort });
};