Initial version #1

Merged
Thilawyn merged 25 commits from base-project into master 2025-09-18 01:26:10 +02:00
3 changed files with 15 additions and 8 deletions
Showing only changes of commit 5dba4eff03 - Show all commits

View File

@@ -1,5 +1,5 @@
import { HttpMiddleware, HttpRouter, HttpServer, HttpServerResponse, Path } from "@effect/platform" import { HttpMiddleware, HttpRouter, HttpServer, HttpServerResponse, Path } from "@effect/platform"
import { Effect, flow, Layer } from "effect" import { Console, Effect, flow, Layer } from "effect"
const router = HttpRouter.empty.pipe( const router = HttpRouter.empty.pipe(
@@ -13,15 +13,21 @@ export const HttpAppDevelopment = router.pipe(
HttpServer.withLogAddress, HttpServer.withLogAddress,
) )
export const HttpAppProduction = Effect.all([ export const HttpAppProduction = Effect.Do.pipe(
Path.Path, Effect.bind("path", () => Path.Path),
Effect.succeed(import.meta.resolve("@website/webapp")), Effect.bind("webappDist", ({ path }) => Effect.map(
]).pipe( path.fromFileUrl(new URL(".", import.meta.resolve("@website/webapp"))),
Effect.map(([path, webappDist]) => router.pipe( v => path.join(v, "dist"),
)),
Effect.map(({ path, webappDist }) => router.pipe(
HttpRouter.all("/", HttpServerResponse.file(path.join(webappDist, "index.html"))), HttpRouter.all("/", HttpServerResponse.file(path.join(webappDist, "index.html"))),
HttpRouter.all("/assets", HttpServerResponse.file(path.join(webappDist, "assets"))), HttpRouter.all("/assets", HttpServerResponse.file(path.join(webappDist, "assets"))),
HttpServer.serve(HttpMiddleware.xForwardedHeaders), HttpServer.serve(flow(
HttpMiddleware.logger,
HttpMiddleware.xForwardedHeaders,
)),
HttpServer.withLogAddress, HttpServer.withLogAddress,
)), )),

View File

@@ -2,7 +2,7 @@
"name": "@website/webapp", "name": "@website/webapp",
"private": true, "private": true,
"type": "module", "type": "module",
"module": "./dist", "module": "./stub.ts",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc -b && vite build", "build": "tsc -b && vite build",

1
packages/webapp/stub.ts Normal file
View File

@@ -0,0 +1 @@
export {}