-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial revision for bun serve
- Loading branch information
1 parent
ce16f32
commit a6b795a
Showing
7 changed files
with
25 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
PLAYWRIGHT_PORT= | ||
SERVER_PORT= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const playwrightConstants = { | ||
url: `http://localhost:${process.env.PLAYWRIGHT_PORT || 8080}/e2e`, | ||
url: `http://localhost:${process.env.SERVER_PORT || 8080}/e2e`, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { MatchedRoute } from "bun"; | ||
|
||
const router = new Bun.FileSystemRouter({ | ||
style: "nextjs", | ||
dir: "./dist/", | ||
}); | ||
|
||
Bun.serve({ | ||
fetch(req) { | ||
const match = router.match(req) as MatchedRoute | ||
const page = require(match.filePath); | ||
return new (page)(req, match.query, match.params); | ||
}, | ||
port: process.env.SERVER_PORT || 8080, | ||
}) | ||
|
||
console.log(`Server running at http://localhost:${process.env.SERVER_PORT || 8080}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters