Skip to content

corsac-dart/rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Corsac RPC

REST-style API server inspired by Dart's rpc package.

Corsac RPC uses standard HttpServer from dart:io as well as some of the corsac-dart components including corsac-dart/kernel, corsac-dart/router.

Status

This library is a work-in-progress so breaking changes may occur without notice.

Usage

Here is simplest "Hello World" implementation:

// file: main.dart
library hello_world;

import 'package:corsac_rpc/corsac_rpc.dart';
import 'package:logging/logging.dart';

@ApiResource(path: '/hello-world/{name}')
class HelloWorldResource {
  @ApiMethod.GET
  HttpApiResponse getHelloWorld(String name) {
    return new HttpApiResponse.json({'myNameIs': name});
  }
}

main() async {
  final kernel = await Kernel.build('prod', {}, []);
  final app = new ApiServer(kernel, [HelloWorldResource]);
  app.start();
}

Documentation

  1. Introduction
  2. API Resources
  3. Middleware pipeline
  4. Additional middlewares:
  5. PrefixMiddleware
  6. VersionMiddleware

About

Corsac RPC - API server library inspired by Dart's rpc package

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages