fenix-hub / godottpd

A routable HTTP server for Godot

Home Page:https://godotengine.org/asset-library/asset/1205

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GodotTPD

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.

Basic workflow

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!")

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()

Documentation

Further information can be found in the API documentation:

Issues and feature requests

Please check out the deep entertainment issue repository if you find bugs or have ideas for new features.

About

A routable HTTP server for Godot

https://godotengine.org/asset-library/asset/1205

License:Other


Languages

Language:GDScript 100.0%