petit_httpd 1.0.4 icon indicating copy to clipboard operation
petit_httpd: ^1.0.4 copied to clipboard

A simple HTTP file server integrated with Let's Encrypt, gzip and CORS.

petit_httpd #

pub package Null Safety Codecov CI GitHub Tag New Commits Last Commits Pull Requests Code size License

This is a simple HTTP file server integrated with Let's Encrypt, gzip and CORS.

Motivation #

Since Dart can run in many native platforms (Linux/x64, macOS/x64/arm64, Windows/x86), it can be an awesome way to have an HTTP Server running in any place, including all the basic features needed today.

API Documentation #

See the API Documentation for a full list of functions, classes and extension.

Usage #

import 'dart:io';

import 'package:petit_httpd/petit_httpd.dart';

void main() async {
  var petitHTTPD = PetitHTTPD(Directory('/var/www'),
      port: 8080,
      securePort: 443,
      bindingAddress: '0.0.0.0',
      letsEncryptDirectory: Directory('/etc/letsencrypt/live'),
      domains: {'mydomain.com': 'contact@mydomain.com'});

  var ok = await petitHTTPD.start();

  if (!ok) {
    print('** ERROR Starting: $petitHTTPD');
    exit(1);
  }

  print('-- STARTED: $petitHTTPD');
}

CLI Tool #

petit_httpd #

The petit_httpd is a CLI for the PetitHTTPD class.

First activate the petit_httpd command:

$> dart pub global activate petit_httpd

To run an HTTP Daemon:

$> petit_httpd ./www --port 8080 --securePort 443 --address 0.0.0.0 --letsencrypt-path /etc/letsencrypt/live --domain mydomain.com

A BASH script with all together:

#!/bin/bash

dart pub global activate petit_httpd

export PATH="$PATH":"$HOME/.pub-cache/bin"

mkdir -p /var/log/petit_httpd

petit_httpd /var/www --address 0.0.0.0 --letsencrypt-path /etc/letsencrypt/live --domain mydomain.com -verbose  >> /var/log/petit_httpd/requests.log

Source #

The official source code is hosted @ GitHub:

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Contribution #

Any help from the open-source community is always welcome and needed:

  • Found an issue?
    • Please fill a bug report with details.
  • Wish a feature?
    • Open a feature request with use cases.
  • Are you using and liking the project?
    • Promote the project: create an article, do a post or make a donation.
  • Are you a developer?
    • Fix a bug and send a pull request.
    • Implement a new feature, like other training algorithms and activation functions.
    • Improve the Unit Tests.
  • Have you already helped in any way?
    • Many thanks from me, the contributors and everybody that uses this project!

If you donate 1 hour of your time, you can contribute a lot, because others will do the same, just be part and start with your 1 hour.

Author #

Graciliano M. Passos: gmpassos@GitHub.

License #

Apache License - Version 2.0

1
likes
130
pub points
0%
popularity

Publisher

unverified uploader

A simple HTTP file server integrated with Let's Encrypt, gzip and CORS.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

args_simple, shelf, shelf_gzip, shelf_letsencrypt, shelf_static

More

Packages that depend on petit_httpd