Important
I am now maintainer as of 7/7/2025. Please see deep-entertainment/issues#56 for details.
A routeable HTTP server for Godot.
This addon for the Godot engine includes classes to start an HTTP server which can handle requests to paths using a set of routers in the way ExpressJS works.
Create a router class that extends HttpRouter. Overwrite the methods that handle the required HTTP methods required for the specific path:
extends HttpRouter
class_name MyExampleRouter
func handle_get(request, response):
response.send(200, "Hello!")
# same for handle_post, handle_delete and so on
This router would respond to a GET request on its path and send back a response with a 200 status code and the body "Hello!".
Afterwards, create a new HttpServer, add the router and start the server. This needs to be called from a node in the SceneTree.
var server = HttpServer.new()
server.register_router("/", MyExampleRouter.new())
add_child(server)
server.start()
You can additionally add functions to the register_router
call to conditionally allow access based on the request.
func isAdmin(request: HttpRequest)
# something something
server.register_router("/", MyExampleRouter.new(), func(request): return isAdmin(request))
Static file delivery loads the whole file, then delivers to the client. This has obvious RAM implications leading to DDOS issues. TLS/SSL is not handled by the server currently. Using services like CloudFlare's tunnel services can supply the TLS/SSL protection, but this isn't ideal.
Further information can be found in the API documentation: