-
Notifications
You must be signed in to change notification settings - Fork 1
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
Created an Example HTTP Function #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to look for a good folder structure and found this project: https://github.com/koltyakov/az-fun-go-sp
Can you check if this is possible?
Idea is that all things related to AzureFunctions should go to AzureFunctions, and outside of it, there should be minimal references to it. Say, tomorrow if we decide to host on AWS Lambda, it should hopefully require us to create another folder and add AWS plumbing there.
Just to clarify, is the high-level plan to port all the logic from Java as-is and replace the current AWS setup with Azure serverless? |
@daltonfury42 I will look into the folder structure. |
Yes, move the entire backend from Java/Postgres to Serverless/MongoDB. We will try to keep the business logic independent of mongo and azure. |
A slightly different take on the folder structure. This seems to be something a lot of people agree on based on the stars. Following it strictly seems too much, but I feel like using this as a guideline is a good idea since a lot of routing, CI scripts and DB logic will come in later. Adding a go.mod file is also a standard I believe for dependency management. |
This is a really good find. I missed these because I was googling for
“serverless golang project folder structures”.
I will be back home in a few hours and will study the repo more. What are
your thoughts? My initial thoughts:
1. Let’s keep azure function specific stuff somewhere?
2. Shall we go with /internal and no /pkg for simplicity? Or should we go
other way around?
3. /cmd we should have for our main.go.
4. Is it okay to keep the app name as “queue”? Then it will be
/cmd/queue/main.go /internal/queue/.. etc
…On Sat, 20 Nov 2021 at 2:58 PM, Nithin ***@***.***> wrote:
@daltonfury42 <https://github.com/daltonfury42> I will look into the
folder structure. Will update you soon.
A slightly different take on the folder structure. This
<https://github.com/golang-standards/project-layout> seems to be
something a lot of people agree on based on the stars. Following it
strictly seems too much, but I feel like using this as a guideline is a
good idea since a lot of routing, CI scripts and DB logic will come in
later. Adding a go.mod <https://go.dev/blog/using-go-modules> file is
also a standard I believe for dependency management.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACV4EOHNGZQDLCWXFIS36U3UM5S43ANCNFSM5IL2SHTQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
For Azure Functions, the structure has to be like -
So, we can have this inside of The source for the handler can be inside So it can look like
The This can make sure we are not just limited to azure functions and if needed it would be possible to deploy the application as a standalone executable or as a container. So, finally it would be like
|
This looks good. Minor modification, will this work:
|
I've reorganized the files a bit to reflect the structure we decided. I've yet to move the function logic itself to
Reason I want to compile as static is because when I deploy the dynamic binary, there is a version mismatch for I am still working on the deployment which seems to be broken from VS Code Azure tools since I moved the Azure Function files. Installing Azure CLI tools was taking a lot of time so I will try with that tomorrow again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can merge this PR as is, and the pending items can be done a follow up PR.
@maaverik Aneesh is added as a collaborator, so will be able to merge his PRs. |
Created a basic HTTP function that returns a message when called. We can build the backend on top of this from hereon. There is one thing that needs to be noted - the go build had to be done to output a static binary because when compiling normally, there is a
glibc
version mismatch. I haven't looked into how to fix this issue yet but it might not be necessary to fix and we can simply use the static build as the deployment.