restful 1.0.1 icon indicating copy to clipboard operation
restful: ^1.0.1 copied to clipboard

A starting point for Dart Restful Api package, for Using Api(HTTP) to Easyly access server info, see demo or examples.

A RestFul Api library for Dart developers.

Usage #

restful api for small things...

your app.dart file example: app.dart


import 'package:restful/restful.dart';

void main() async {
  /// Step#1 register routes
  Api.auto('/', 'Hello world'); 
  Api.get('/index.html', File('example/html/index.html'));
  Api.get('/some.route', () {
    return 'some function';
  });
  Api.get('/some.json', () {
    return Api.json({
      'msg': 'some function',
      'list': [0, 1, 2]
    });
  });

  /// Step#2  start listen api
  await Api.listen(host: '127.0.0.1', port: 4040);

  /// Step#3 open http://127.0.0.1:4040/ visit on browser
}

Listening on http://127.0.0.1:4040/

Docker configuration: #

Dockerfile

#!/bin/bash

version="dart-restful"

docker build -t "$version" .

docker run -d -p 4040:4040 --name="$version-test" "$version"

docker ps
4
likes
70
pub points
43%
popularity

Publisher

unverified uploader

A starting point for Dart Restful Api package, for Using Api(HTTP) to Easyly access server info, see demo or examples.

Homepage

Documentation

API reference

License

Icon for licenses.unknown (LICENSE)

Dependencies

mime

More

Packages that depend on restful