micro_serve 1.0.4
micro_serve: ^1.0.4 copied to clipboard
A Flutter package initializes an HTTP server to handle HTTP requests.
Micro Serve #
The micro_serve package for Flutter is designed to initialize an HTTP server that efficiently manages requests and server-side operations within applications.
Features #
-
HTTP Handling: Manage incoming HTTP requests and send responses.
-
Routing: Define routes (GET, POST, PUT, DELETE, PATCH) and link them to request handlers.
-
Request Parsing: Read and parse query parameters and body data from requests.
-
Response Handling: Create and send responses with status codes, headers, and content.
-
Error Handling: Gracefully manage errors and send appropriate error responses.
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 #
Micro Serve plugin is developed by Mahadi Hassan