Getting started
GodotHTTPServer is an HTTP/HTTPS server that runs inside Godot 4.7 or later. Use it for game servers, REST APIs, dashboards, and file hosting.
Requirements
- Godot 4.7 or later.
- A Godot project where you can install the addon.
Install the addon
- Copy the
addons/godothttpserverdirectory into your project’saddons/folder. - Open Project Settings > Plugins.
- Enable the GodotHTTPServer plugin.
Add the server node
- Open or create a scene.
- Add an
HTTPServernode to the scene tree. - Attach a script that starts the server.
Run your first server
@onready var server: HTTPServer = $HTTPServer
func _ready() -> void:
server.router.handle_get("/", _handle_root)
var err := server.start(8080)
if err != OK:
push_error("Failed to start server: %s" % error_string(err))
func _handle_root(_path_params: Dictionary, _query: Dictionary, _headers: Dictionary, _body: Variant) -> HTTPResponse:
return HTTPResponse.ok("Hello, world!")
Verify the server
- Run the scene.
- Open
http://localhost:8080/in a browser or withcurl:
curl http://localhost:8080/
- Confirm the response body shows
Hello, world!.
Next steps
- Learn routing and DTO validation in Routes and DTOs.
- Add middleware in Middleware.
- Configure the server in Configuration.