-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Submission: bun.sh (JavaScript runtime) #155
Comments
Thanks for the submission. @LucasRoesler can you please make all the necessary suggestions - like: Example of how to use a package manager within the template, and how to consume a package within a handler. Making the Dockerfile use a non-root user And all that kind of stuff? |
Hi @patlux there are a couple of things that I notice in your template
|
@LucasRoesler Thank you for the detailed answer!
I tried, but how does the development cycle works here? As a user, I want to have a nice DX where I can run my server with live-reload when I update my code. With the current approach I do the following steps: faas-cli new my-fancy-bun --lang bun
tree my-fancy-bun
├── my-fancy-bun
│ ├── README.md
│ ├── bun.lockb
│ ├── index.ts
│ ├── package.json
│ └── tsconfig.json
cat index.ts
# export const bunServeOptions: Serve = {
# port: 3000,
# fetch: (request: Request) => {
# return new Response('Hello via Bun!', { status: 200 })
# },
# }
cd my-fancy-bun
bun run --watch index.ts Now I can make changes to When I finish I just run cd ..
faas-cli up -f my-fancy-bun.yml But how do I this with your suggested approach? faas-cli new my-fancy-bun --lang bun
tree my-fancy-bun
├── my-fancy-bun
│ ├── README.md
│ ├── bun.lockb
│ ├── handler.ts
│ ├── package.json
│ └── tsconfig.json
cd my-fancy-bun
cat handler.ts
# export const handler = (request: Request) => {
# return new Response(`Hello from bun via openfaas!`)
# } Now what? How do I develop now my function without having to rebuild the docker image on each change? I can't just run
|
Ok I think I found a solution to my problem mentioned in my previous comment. I hope I could address all your comments :) |
@patlux it is looking pretty good. But I have a question about dependency management. The template has two package.json files in it. When i look at the Dockerfile, it isn't obvious to me when the I think it would be interesting to see an example of a project with a non-trivial dependency. I would be also curious to see an example where the user accidentally sets the port in their handler and then we see the warning message from |
I would like to suggest adding a bun template to the official store.
https://github.com/patlux/openfaas-bun-template
Proposed templates.json:
What is bun?
The text was updated successfully, but these errors were encountered: