パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.1.0+13

dchisel

REST APIを作成するためのシンプルなDart Webフレームワーク。DChiselはカスタムミドルウェアおよびMySQLとPostgreSQLのORMをサポートしています。

30日間ダウンロード
11
いいね数
46
Pub ポイント
80

パッケージをインストール

flutter pub add dchisel

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

DChiselは、REST APIの構築に特化した軽量なDartウェブフレームワークです。MySQLおよびPostgreSQLのORMを内蔵サポートしており、データベースとのスムーズな連携を可能にします。開発者はリクエスト処理やルーティングロジック用にカスタムミドルウェアを実装できます。シンプルさとパフォーマンスに焦点を当てており、構造化されたAPI開発とデータベース統合を必要とするバックエンドサービスに最適です。Dart上で動作し、Web環境向けのサーバーサイドアプリケーションに適しています。

用途

  • RESTful API の構築
  • データベース駆動型のバックエンドサービス
  • ミドルウェアベースのリクエスト処理
  • サーバーサイドのDartアプリケーション
  • MySQL/PostgreSQL インテグレーションを備えた API

主な機能

  • カスタムミドルウェアのサポート
  • MySQL および PostgreSQL ORM
  • 軽量で高速
  • シンプルな REST API 構造
  • Dartネイティブなサーバーサイド実行

適している対象

  • Dart を使用するバックエンド開発者
  • APIファーストのアプリケーションを開発するチーム
  • データベースORMを必要とするプロジェクト
  • 最小限のオーバーヘッドを伴うWebサーバー
  • シンプルなサーバーフレームワークを探している開発者

注意事項

  • 制限されたプラットフォーム対応(モバイルやデスクトップは対応していません)
  • 組み込み認証なし
  • 複雑な設定には手動での構成が必要です
  • UI中心のアプリケーションには適していません
  • コミュニティメンテナンスに依存

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Dchisel Logo

DChisel Dart Framework

DChisel is simple Dart Framework for creating REST API

pub package

English Documentation Indonesia Documentation

Features

  • Custom host server and port
  • GET, POST, PUT, DELETE, PATCH Routes
  • ORM CRUD to PostgreSQL
  • ORM CRUD to MySQL
  • Global Middleware
  • Specific Route Middleware
  • Auth
  • Base Response Ok & Forbidden
  • Header CORS
  • Base64 decode to File
  • Hotreload

Usage

To add the dchisel to your Dart application read the install instructions.

Host Server

Default host is "localhost" and port 8000

import 'package:dchisel/dchisel.dart';

Future<void> main(List<String> arguments) async {
  DRoute route() {
    var droute = DRoute();
    droute.get('/', (Request req) async => resOk("Hello, DChisel"));
    return droute;
  }
  DChisel().serve(getroutes: route());
}

If you want to change the host to 0.0.0.0 and port to 5555 you can use :

 DChisel().serve(getroutes: route(), serverHost: '0.0.0.0', serverPort: 5555);
GET Route
droute.get('/hello', (Request request) {
    return 'Hello, World';
});

GET with param you can use :

droute.get('/getparam/<name>', (Request request, String name) {
    return 'Hello, $name';
});
POST Route
droute.post('/hello', (Request request) async {
    return 'Hello, World';
});

If you want to get Body value from your POST request, use :

var body = await request.body.asJson;

If you want to get Header value from your POST request, use :

var headers = await request.headers;
PUT Route
droute.put('/hello/<name>', (Request request, String name) async {
  return 'Hello, $name';
});

PUT also can get Header and Body request

var headers = await request.headers;
var body = await request.body.asJson;
DELETE Route
droute.delete('/hello/<name>', (Request request, String name) async {
  return 'Hello, $name';
});

Dchisel ORM

For now, DChisel only support PostgreSQL and MySQL

DB Config
DChiselDB().configDB('dialect', // DIALECT DATABASE, IF YOU USE POSTGRESQL CHANGE 'dialect' to 'postgre', IF YOU USE MYSQL CHANGE 'dialect' to 'mysql'
    host: 'your_host',
    db: 'your_db_name',
    port: your_port, //integer
    username: 'your_db_username',
    password: 'your_db_password');
Get All Data
DChiselDB().getAll('your_table_name');
Get Data With Custom Column and Filter
DChiselDB().getOption('your_table_name', 
    column: 'your_column1,your_column2', 
    where: ['your_column_name', 'your_filter_value']);

If you want filter contains, just add % into your filter value, example :

'%your_filter_value%'
Create Data
DChiselDB().create('users', data: {
    'your_column_name': 'your_value'
});
Update Data
DChiselDB().update('users', data: {
    'your_column_name': 'your_value'
}, where: ['your_filter_column_name', 'your_filter_value']);
Delete Data
DChiselDB().deleteAll('your_table_name');
Delete Data Custom Filter
DChiselDB().deleteOption('your_table_name', where: ['your_filter_column_name', 'your_filter_value']);

Issues

Please file any issues, bugs or feature requests as an issue on our GitHub page. Commercial support is available, you can contact us at <alphacsoft@gmail.com>.

Want to contribute

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.

Author

This dchisel framework for Dart is developed by Alphacsoft.

カテゴリー

依存関係

依存関係一覧 14 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。