패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.1.0+13

dchisel

REST API를 생성하기 위한 간단한 Dart 웹 프레임워크입니다. DChisel은 사용자 정의 미들웨어 및 MySQL 및 PostgreSQL ORM을 지원합니다.

30일 다운로드
11
좋아요
46
Pub 점수
80

패키지 설치

flutter pub add dchisel

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

DChisel은 REST API를 구축하기 위해 설계된 가벼운 Dart 웹 프레임워크입니다. MySQL 및 PostgreSQL ORM에 내장된 지원을 제공하여 원활한 데이터베이스 상호작용을 가능하게 합니다. 개발자는 요청 처리 및 라우팅 로직을 위한 사용자 정의 미들웨어를 구현할 수 있습니다. 단순성과 성능에 초점을 맞춘 DChisel은 구조화된 API 개발과 데이터베이스 통합이 필요한 백엔드 서비스에 적합합니다. Dart에서 실행되며 웹 환경을 대상으로 한 서버 측 애플리케이션에 적합합니다.

사용 사례

  • RESTful API 구축
  • 데이터베이스 기반 백엔드 서비스
  • 미들웨어 기반의 요청 처리
  • 서버 측 Dart 애플리케이션
  • MySQL/PostgreSQL 통합을 지원하는 API

주요 기능

  • 사용자 정의 미들웨어 지원
  • MySQL 및 PostgreSQL ORM
  • 경량이고 빠름
  • 간단한 REST API 구조
  • Dart 네이티브 서버 사이드 실행

적합한 대상

  • Dart를 사용하는 백엔드 개발자
  • API 중심 애플리케이션을 구축하는 팀
  • 데이터베이스 ORM이 필요한 프로젝트
  • 최소의 오버헤드를 가진 웹 서버
  • 간단한 서버 프레임워크를 찾는 개발자

고려 사항

  • 제한된 플랫폼 지원(모바일 또는 데스크톱 지원 없음)
  • 내장 인증 없음
  • 복잡한 설정을 위해서는 수동 구성이 필요합니다
  • 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.