1.0.6 • Published 4 months ago

hamroun-fullstack v1.0.6

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

Hamroun Fullstack Framework

Full-stack JavaScript framework with integrated SSR and API handling.

Installation

npm install hamroun-fullstack frontend-hamroun

Usage

import Server, { createElement, useState } from 'hamroun-fullstack';

// Initialize server with options
const app = new Server({
    staticDir: './public',    // Static files directory
    apiDir: './src/api',      // API routes directory
    clientBundles: ['/dist/client.js'] // Client-side bundles
});

// Define a frontend component
function Counter(props) {
    const [count, setCount] = useState(props.initial || 0);
    return createElement('button', {
        onClick: () => setCount(count + 1)
    }, count);
}

// API route
app.getApp().post('/api/increment', (req, res) => {
    res.json({ count: req.body.count + 1 });
});

// SSR route with hydration
app.getApp().get('/', (req, res) => {
    res.ssr(Counter, { initial: 0 });
});

app.listen(3000);

Features

  • Unified API and frontend server
  • Server-side rendering
  • Client-side hydration
  • Automatic API route loading
  • Static file serving
  • TypeScript support
1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

1.0.1

5 months ago

1.0.0

5 months ago