Jaguar Dev Proxy는 개발 환경을 위한 역방향 프록시 구현체로, 백엔드 및 웹 서버 작업 흐름을 간소화하도록 설계되었습니다. 개발 중에 로컬 서비스와 외부 엔드포인트 사이의 요청을 원활하게 라우팅할 수 있게 해줍니다. Dart로 작성되었으며 Jaguar 생태계의 일부로서 Android, iOS, macOS, Windows, Linux 등 여러 플랫폼을 지원합니다. 이 패키지는 로컬 설정에서 API 모킹, 서비스 통합 테스트, 크로스 오리진 통신을 간편하게 만들어 줍니다. Jaguar 기반 백엔드를 사용하거나 복잡한 구성 없이 가벼운 프록시가 필요한 팀에게 이상적입니다.
사용 사례
로컬 API 라우팅
개발 환경 프록시
서비스 통합 테스트
API 모킹
크로스 오리진 요청 처리
주요 기능
역방향 프록시 기능
다중 플랫폼 지원
경량 설계
원활한 개발 워크플로우 통합
내장된 요청/응답 조작
적합한 대상
백엔드 개발자
풀스택 플러터 개발자
데브옵스 엔지니어
API 테스트 팀
Jaguar 프레임워크 사용자
고려 사항
생산 사용을 위한 것이 아님
복잡한 라우팅을 위해서는 수동 구성이 필요합니다
성숙한 프록시에 비해 문서가 제한적
개발 전용 시나리오에 가장 적합
Jaguar 생태계에 의존
원본 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();
}