micro_serve 1.0.0
micro_serve: ^1.0.0 copied to clipboard
The package for Flutter is designed to initialize an HTTP server that efficiently manages HTTP requests.
Micro Serve #
The micro_serve package for Flutter is designed to initialize an HTTP server that efficiently manages HTTP requests.
Features #
-
HTTP Handling Ability to handle incoming HTTP requests and send appropriate responses.
-
Routing Support for defining routes (GET, POST, PUT, DELETE, PATCH) and mapping them to specific request handlers.
-
Request Parsing Capability to read and parse query parameters and body data from incoming requests.
-
Response Handling Ability to construct and send structured responses to clients, including setting status codes, headers, and body content.
-
Error Handling Mechanism to handle server-side, method errors gracefully and send appropriate error responses to clients.
Getting started #
Add the package to your
pubspec.yamlfile:
dependencies:
micro_serve: ^<latest version>
Usage #
Import the Package:
import 'package:micro_serve/micro_serve.dart';
Initialize the Server:
void main() {
final MicroServe server = MicroServe();
server.get("/hello", (ServerContext serverContext) async {
Response response = Response(
statusCode: 200,
data: "Welcome Micro-Serve",
);
serverContext.send(response);
});
server.listen(ipAddress: "127.0.0.1", port: 2000);
}
Additional information #
This package simplifies server-side operations within a Flutter application, making it ideal for developers looking to integrate server capabilities directly into their apps.
This Micro Server plugin is developed by Mahadi Hassan.