Skip to content

HTTP server docs #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 11, 2025
Merged

HTTP server docs #529

merged 10 commits into from
Mar 11, 2025

Conversation

vlaaad
Copy link
Contributor

@vlaaad vlaaad commented Mar 10, 2025

No description provided.

vlaaad added a commit to defold/defold that referenced this pull request Mar 10, 2025
Now editor scripts may add routes to the built-in HTTP server, e.g.:
```lua
function M.get_server_routes()
  return {
    http.server.route("/my-extension/files/{*file}", function(request)
      local attrs = editor.external_file_attributes(request.file)
      if attrs.is_file then
        return http.server.external_file_response(request.file)
      else
        return http.server.response(404, "Not found")
      end
    end)
  }
end
```

Technical notes:

Doc PR: defold/doc#529

Fixes #10272
vlaaad added a commit to defold/defold that referenced this pull request Mar 11, 2025
* Add editor HTTP server extensibility

Now editor scripts may add routes to the built-in HTTP server, e.g.:
```lua
function M.get_server_routes()
  return {
    http.server.route("/my-extension/files/{*file}", function(request)
      local attrs = editor.external_file_attributes(request.file)
      if attrs.is_file then
        return http.server.external_file_response(request.file)
      else
        return http.server.response(404, "Not found")
      end
    end)
  }
end
```

Technical notes:

Doc PR: defold/doc#529

Fixes #10272

* Add regex coercer test
vlaaad added a commit to defold/defold that referenced this pull request Mar 11, 2025
* Refactor editor http server implementation

This will allow us to expose it to editor scripts without too much pain for the users.

Related to #10272

* Review fixes

* Add editor HTTP server extensibility (#10314)

* Add editor HTTP server extensibility

Now editor scripts may add routes to the built-in HTTP server, e.g.:
```lua
function M.get_server_routes()
  return {
    http.server.route("/my-extension/files/{*file}", function(request)
      local attrs = editor.external_file_attributes(request.file)
      if attrs.is_file then
        return http.server.external_file_response(request.file)
      else
        return http.server.response(404, "Not found")
      end
    end)
  }
end
```

Technical notes:

Doc PR: defold/doc#529

Fixes #10272

* Add regex coercer test
@vlaaad vlaaad merged commit a21f2dc into master Mar 11, 2025
2 checks passed
@vlaaad vlaaad deleted the issue-10272 branch March 11, 2025 13:02
menaechmi pushed a commit to menaechmi/defold that referenced this pull request Mar 14, 2025
* Refactor editor http server implementation

This will allow us to expose it to editor scripts without too much pain for the users.

Related to defold#10272

* Review fixes

* Add editor HTTP server extensibility (defold#10314)

* Add editor HTTP server extensibility

Now editor scripts may add routes to the built-in HTTP server, e.g.:
```lua
function M.get_server_routes()
  return {
    http.server.route("/my-extension/files/{*file}", function(request)
      local attrs = editor.external_file_attributes(request.file)
      if attrs.is_file then
        return http.server.external_file_response(request.file)
      else
        return http.server.response(404, "Not found")
      end
    end)
  }
end
```

Technical notes:

Doc PR: defold/doc#529

Fixes defold#10272

* Add regex coercer test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant