Skip to content

A minimal SSR "framework" for building web applications using Deno. Uses JSX for defining pages, layouts, and components. Includes a file-based router similar to Next.js.

License

Notifications You must be signed in to change notification settings

twilkinson3421/neuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@neuf/neuf

A simple barebones SSR web framework for Deno. Uses preact JSX for templating. Support for file-based routing, dynamic routes, catch-all routes, and route-groups. Build pages using JSX components, pages, layouts, 'documents', and 'route-handlers'.

Basic Usage

import { listen, serve, router, type ServeOptions } from "@neuf/neuf";
import { relative, join } from "@std/join";
import { render } from "preact-render-to-string";

const importFn: ServeOptions["importFn"] = async path => {
    const thisModuleDir = import.meta.dirname!;
    const toCwd = relative(thisModuleDir, Deno.cwd());
    const fullPath = join(toCwd, path);
    return await import(fullPath);
};

listen({
    hostname: "0.0.0.0",
    port: 8080,
    handler: (req, res, isError) => {
        return serve(req, res, {
            isError,
            isNotFound: false,
            staticOptions: { fsRoot: "src/public", quiet: true },
            importFn,
            router,
            renderJSX: render,
        });
    },
});

Planned Features

  • First-party i18n solution
  • Middleware support
  • More informative logging

License

MIT

About

A minimal SSR "framework" for building web applications using Deno. Uses JSX for defining pages, layouts, and components. Includes a file-based router similar to Next.js.

Topics

Resources

License

Stars

Watchers

Forks