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

  1. Copy the addons/godothttpserver directory into your project’s addons/ folder.
  2. Open Project Settings > Plugins.
  3. Enable the GodotHTTPServer plugin.

Add the server node

  1. Open or create a scene.
  2. Add an HTTPServer node to the scene tree.
  3. 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

  1. Run the scene.
  2. Open http://localhost:8080/ in a browser or with curl:
curl http://localhost:8080/
  1. Confirm the response body shows Hello, world!.

Next steps