utopia_http 0.1.0 copy "utopia_http: ^0.1.0" to clipboard
utopia_http: ^0.1.0 copied to clipboard

A light and easy to get started with HTTP framework for Dart

Utopia HTTP Server #

Light and Fast Dart HTTP library to build awesome Dart server side applications. Inspired from Utopia PHP ecosystem.

Getting Started #

First add the dependency in your pubspec.yaml

dependencies:
  utopia_http: ^0.1.0

Now, in main.dart, you can

import 'dart:io';
import 'package:utopia_http/utopia_http.dart';

void main() async {
  final address = InternetAddress.anyIPv4;
  final port = Http.getEnv('PORT', 8080);
  final app = Http(ShelfServer(address, port), threads: 8);

  app.get('/').inject('request').inject('response').action(
    (Request request, Response response) {
      response.text('Hello world');
      return response;
    },
  );
  
  await app.start();
}

The MIT License (MIT) https://www.opensource.org/licenses/mit-license.php

4
likes
140
pub points
0%
popularity

Publisher

verified publisherappwriters.dev

A light and easy to get started with HTTP framework for Dart

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

http_parser, mime, shelf, shelf_static, string_scanner, utopia_di

More

Packages that depend on utopia_http