by sandruso on 8/25/24, 3:25 PM with 1 comments
by sandruso on 8/25/24, 3:25 PM
during past few days I was exploring concept of single source file applications where you can hide the build system.
I've cobbled together snaptail which hides nextjs build system and allows to work with just a single file.
It works great for fast prototyping or building an internal/local apps.
There is also support for API routes that can be exported via api variable.
An example:
// myapp.tsx
export const App = () => <div>Hello world!</div>
export const api = [
{
method: "GET", path: "/api/hello",
handler: async (req, reply) => {
return reply.send({ hello: "world" });
}
}
];
// shell:
npx snaptail myapp.tsx