bun
bun copied to clipboard
express support
required to make express work:
- [x] polyfill require('depd')
- [x] fix require('iconv-lite');
- [x] fix require('object-inspect')
- [x] polyfill require('node:net').isIP
- [x] polyfill require('node:http') apis
- [x] polyfill setImmediate (used by express)
optional:
- [ ] polyfill require('node:https') apis
- [ ] polyfill Error.captureStackTrace (only used by depd)
express bugs:
- [ ] router misbehaving (calls
app.get('/')
handler but returnsCannot get /
page)
fixes #405
when i tried to run express :
i found https://github.com/oven-sh/bun/issues/747
with error Cannot found module "./utils.inspect"
and then i tried putting __dirname in front of "./utils.inspect" the issue is solved
it means some how bun is failed to import js file of same dir after issue solved another issue occurred
here is error on line no 43
Function setImmediate
is part of many packages too. For example: https://www.npmjs.com/package/glob
Seems there is a problem with Oak, too. I tried using it because it was born for Deno, that should have similar web request/response API of Bun, but that's not so.
Anyone knows a library working with Bun that makes simple make servers like Express or Oak?
@Bellisario Try look for this https://github.com/apvarun/awesome-bun. Hope it helps
Thanks @adamjosefus, this helps!!!
Maybe for now I'll use Bao.js, seems it's very similar to Express and Oak!
when i tried to run express : i found #747 with error Cannot found module "./utils.inspect" and then i tried putting __dirname in front of "./utils.inspect" the issue is solved it
This worked for me too although there are some follow-up issues.
i just want to comment that as of 0.1.7, express slightly works, but i want to note that this code doesn't work yet.
import express from 'express';
const app = express();
app.get('/', (req, res) => {
res.send('Hello World!'); // wont cause the response to end, which will hang any client requests. calling .end fixes it.
});
app.listen(3000, () => {
console.log('http://localhost//3000!');
});
Any updates for that issue would like to use express with bun
Any updates for that issue would like to use express with bun
The above example works in v0.1.10, you could give it a try :)
@evanwashere I found an https polyfill, it uses the http module, which is already polyfilled: https://github.com/substack/https-browserify/blob/master/index.js
I can't help more because I'm not a Zig programmer, but I'm ready for any other JS/TS help!
This is fixed