Skip to main content

farrow-vite

Vite adapter for farrow-http.

Combining farrow, farrow-http, farrow-api and farrow-vite, we can setup a modern full-stack development.

Installation

yarn add -D farrow-vite

Usage

yarn add -D vite farrow farrow-vite
import path from "path";
import { Http } from "farrow-http";
import { vite } from "farrow-vite";

import { services } from "./api";

let http = Http();

http.use(services);

if (process.env.NODE_ENV === "development") {
// set up vite-dev-server in development
http.use(vite());
} else {
// serving the bundler output in production
http.serve("/", path.join(__dirname, "../dist/client"));
}

http.listen(3002, () => {
console.log("server started at http://localhost:3002");
});

Add script in package.json

{
"scripts": {
"dev": "farrow dev",
"build": "tsc && vite build && farrow build"
}
}

API

vite

const vite: (options?: InlineConfig | undefined) => RouterPipeline;

Learn more

Relative Module
  • farrow-http: A Type-Friendly Web Framework.
  • vite: Next Generation Frontend Tooling.