/othus

🆕 typescript-based framework

Primary LanguageJavaScriptApache License 2.0Apache-2.0

💫 othus

🆕 typescript-based framework

Links: npm, github

💬 Differences from express

  • Create an xml grammar from within the typescript file.
  • More detailed information than ever before.
  • Stronger routing than traditional routers.

📌 Installation

Run from the shell of the operating system:

$ npm install othus

📂 Recommended Directory Structure

index.ts
src/
    components/
        Header.ts
    App.ts

💾 Example

index.ts

import othus from 'othus';

import { App } from './src/App';

othus.render(
    <App path="/" />
);

src/App.ts

import othus from 'othus';

import { Header } from './components/Header';

const cors = () => () => {};

export const App: othus.ITF = {
    middleware: [cors()],
    stateOptions: (option) => option,
    body: (req, res) => {
        res.state(`text`, `0`);

        const count = (req, res) => {
            res.state(`text`, res.state(`text`) + 1);
        };
				
        const elements = othus.compile(
            <p className="count">{res.state(`text`)}</p>
            <p className="count-btn" onClick={count}>count</p>
        );

        res.send(elements, req.path);
    }
}