api.listen(3000, async () => {
console.log(
Server started on port 3000
);
});
5. Run `bun run main.js`.
6. Open the `http://localhost:3000/` in the browser.
7. Check the logs.
### What is the expected behavior?
The log must include the status code and size of the response, as it is shown in the following log (the log was obtained after running the code snippet with node - `node main.js`):
[Sat, 04 May 2024 23:31:35 GMT] (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36) "GET / HTTP/1.1" 200 12 10.813 ms
### What do you see instead?
As it is shown in the following log, the status code and size of the response is missing ("-"):
[Sat, 04 May 2024 23:34:38 GMT] (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36) "GET / HTTP/1.1" - - 1.703 ms
### Additional information
If you run the code snippet in the file using `node main.js` the logs are correct, the problem happens when is run using `bun run main.js`
What version of Bun is running?
1.0.7
What platform is your computer?
Linux 5.15.146.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
bun add express morgan
main.js
.main.js
:const api = express();
morgan.token("who", (req) => { const who = req.headers["origin"] || req.headers["user-agent"] || "Unknown WHO"; return who; });
api.use( morgan( '[:date[web]] (:who) ":method :url HTTP/:http-version" :status :res[content-length] :response-time ms' ) );
api.get("/", (req, res) => { res.send("Hello World!"); });
api.listen(3000, async () => { console.log(
Server started on port 3000
); });