auftakt
v0.5.1
Published
**NOTE** This is still in early development.
Readme
auftakt
NOTE This is still in early development.
Vite plugin for simple fullstack development. Inspired by bun's fullstack dev server.
Develop with full hmr on both the client and the server in one go. Uses μWebSockets on the server.
Usage
npm install auftaktvite.config.ts
import { defineConfig } from "vite";
import { auftakt } from "auftakt/vite";
export default defineConfig({
plugins: [
auftakt({
entry: "src/server/main.ts",
}),
],
});src/server/main.ts
import { serve } from "auftakt";
import Index from "../client/index.html";
import NotFound from "../client/404.html";
serve({
routes: {
"/": Index,
},
websocket: {
open(socket) {
console.log("New connection!");
socket.send("HELLO :)");
},
message(socket, message) {
console.log("Got message", message);
},
close(socket, code, message) {
console.log("Connection closed :(");
},
},
fetch(request) {
return NotFound;
},
});// TODO: Provide example for html files.
Now run:
npx vite