Jaguar는 성능이 뛰어나고 생산 준비가 완료된 Dart용 HTTP 서버 프레임워크로, 속도, 간결성 및 확장성을 목표로 설계되었습니다. 개발자 경험에 중점을 두어 확장 가능한 백엔드 서비스와 웹 API를 빠르게 개발할 수 있도록 합니다. Jaguar는 비동기 프로그래밍을 지원하고 모듈식 아키텍처를 제공하여 소규모 프로젝트부터 대규모 애플리케이션까지 모두 적합합니다. Android, iOS, macOS, Windows, Linux 등 다양한 플랫폼에서 원활하게 작동합니다.
사용 사례
RESTful API 구축
마이크로서비스 생성
실시간 웹 서버 개발
모바일 앱용 백엔드 로직 구현
서버 측 Dart 애플리케이션 실행
주요 기능
고성능 HTTP 서버
모듈형이고 확장 가능한 설계
async/await에 대한 내장 지원
간편한 라우팅 및 미들웨어 통합
크로스 플랫폼 호환성
적합한 대상
백엔드 서비스를 구축하는 Dart 개발자
빠르고 신뢰할 수 있는 HTTP 서버가 필요한 팀
경량 및 확장 가능한 API가 필요한 프로젝트
Dart를 사용한 모바일 앱 백엔드
풀스택 Dart 애플리케이션
고려 사항
성숙한 프레임워크에 비해 생태계가 제한적
Dart의 비동기 모델에 대한 이해가 필요합니다
Express.js 또는 Spring Boot와 같은 대안보다 더 작은 커뮤니티
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Jaguar
Jaguar is a full-stack production ready HTTP server framework built to be fast, simple and intuitive.
Getting started
Familiar way to write routes
Jaguar class provides methods get, put, post,
delete and options to quickly add route handlers for specific HTTP methods.
main() async {
final server = Jaguar(); // Serves the API at localhost:8080 by default// Add a route handler for 'GET' method at path '/hello'
server.get('/hello', (Context ctx) => 'Hello world!');
await server.serve();
}
Powerful route matching
Easily define and access Path parameters
Path segments prefixed with : can match any value and are also captured as path variables. Path variables can be accessed
using pathParams member of Context object.
main(List<String> args) async {
final quotes = <String>[
'But man is not made for defeat. A man can be destroyed but not defeated.',
'When you reach the end of your rope, tie a knot in it and hang on.',
'Learning never exhausts the mind.',
];
final server = Jaguar();
server.get('/api/quote/:index', (ctx) { // The magic!finalint index = ctx.pathParams.getInt('index', 1); // The magic!return quotes[index + 1];
});
await server.serve();
}
A path can have multiple path variables.
A path variable can appear at any position in the path.
A path variable can be matched against a Regular expression.
getInt, getDouble, getNum and getBool methods can be used to easily typecast path variables.
Using * as the final path segment captures/matches all following segments.
Easily access Query parameters
Query parameters can be accessed using queryParams member of Context object.
main(List<String> args) async {
final quotes = <String>[
'But man is not made for defeat. A man can be destroyed but not defeated.',
'When you reach the end of your rope, tie a knot in it and hang on.',
'Learning never exhausts the mind.',
];
final server = Jaguar();
server.get('/api/quote', (ctx) {
finalint index = ctx.queryParams.getInt('index', 1); // The magic!return quotes[index + 1];
});
await server.serve();
}
getInt, getDouble, getNum and getBool methods can be used to easily typecast query parameters into desired type.
One liner to access Forms
A single line is all it takes to obtain a form as a Map<String, String> using method bodyAsUrlEncodedForm
on Request object.
The method staticFiles adds static files to Jaguar server. The first argument determines
the request Uri that much be matched and the second argument determines the directory from which the target files are fetched.
main() async {
final server = Jaguar();
server.staticFiles('/static/*', 'static'); // The magic!await server.serve();
}