simplehttp 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 48

A dart library used for making a simple HTTP server.

This should be used for testing purposes and not for real production.

As you can see in the example it's still bare bones.

Example #

import 'package:simplehttp/simplehttp.dart';

void main() {
  final application = SimpleHttp(port: 8080);
  application.get('/', (request, response) {
    response.status(200).json({
      'Test': 1,
    });
  });

  application.get('/:id', (request, response) {
    print(request.segments()[0]);
    response.status(200);
  });

  application.post('/post', (request, response) async {
    print(await request.body());
  });

  application.start();
}

0.0.3

  • Initial version, created by Stagehand

example/example.dart

import 'package:simplehttp/simplehttp.dart';

void main() {
  final application = SimpleHttp(port: 8080);
  application.get('/', (request, response) {
    response.status(200).json({
      'Test': 1,
    });
  });

  application.get('/:id', (request, response) {
    print(request.segments()[0]);
    response.status(200);
  });

  application.post('/post', (request, response) async {
    print(await request.body());
  });

  application.start();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  simplehttp: ^0.0.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:simplehttp/simplehttp.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because:

  • package:simplehttp/simplehttp.dart that imports:
  • package:simplehttp/src/response.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:simplehttp/simplehttp.dart that imports:
  • package:simplehttp/src/response.dart that imports:
  • dart:io

Health issues and suggestions

Document public APIs. (-1 points)

10 out of 10 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.8.1 <3.0.0
Dev dependencies
pedantic ^1.9.0
test ^1.14.4