How do I use Go for backend for svelte MPA?

huangapple go评论73阅读模式
英文:

How do I use Go for backend for svelte MPA?

问题

我想在我的Svelte应用程序中使用Go作为Web服务器,该应用程序具有多个HTML页面。
我希望能够使用基于文件系统的路由器,但任何路由器都可以。
我还需要它能够与具有热重载功能的开发服务器配合使用。

如果我对这些术语的理解有误,请纠正我(我对这方面不太有经验)。

英文:

I would like to use go for the webserver for my svelte application that has multiple html pages.
I would prefer it if I could use a file system based router but any would be fine.
I also need this to work with some kind of development server that has hot reload.

I hope I am understanding all this and its terminology correctly (I'm not very experienced with this kind of thing) so please correct me if I'm wrong.

答案1

得分: 3

请查看以下两篇文章:

使用Golang和Svelte创建网站

将Go(golang)和SvelteKit结合用于GUI

我目前在使用Go来构建我的API,然后使用Svelte(SvelteKit)作为独立的客户端,通过对Go API进行fetch调用。虽然这些文章中没有提供完全相同的内容,但我相信它们会提供一些很好的背景信息。

英文:

Check out these two articles:

Creating a website using Golang and Svelte

Combine Go (golang) and SvelteKit for GUI

I am currently using Go for my API and then a seperate client in svelte (sveltekit) that makes fetch calls to the Go API. Although this isn't exactly provided in those articles, I believe they will provide some solid context.

答案2

得分: 0

你可以使用https://github.com/kokizzu/svelte-mpa。

它将Svelte的默认行为从组件更改为页面,所有组件都应以下划线开头。

我正是为了多页面应用场景而构建了这个。

英文:

You can use https://github.com/kokizzu/svelte-mpa

It changes default Svelte behavior from component to page, all component should start with underscore.

I built this exactly for MPA use-case.

huangapple
  • 本文由 发表于 2022年8月31日 21:34:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/73556707.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定