सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
Fennec एक बहु-थ्रेडेड, विश्वसनीय Dart सर्वर-साइड फ्रेमवर्क है जो उच्च प्रदर्शन बैकएंड सेवाओं के निर्माण के लिए डिज़ाइन किया गया है। यह डेवलपर्स को Dart का उपयोग करके स्केलेबल वेब सर्वर और API बनाने में सक्षम बनाता है, जो एक साथ कई अनुरोधों को प्रभावी ढंग से संभालने के लिए समानांतरता का उपयोग करता है। भरोसेमंदता और गति को ध्यान में रखते हुए बनाया गया Fennec Android, iOS, macOS, Windows और Linux पर डेप्लॉयमेंट का समर्थन करता है, जिससे यह क्रॉस-प्लेटफॉर्म बैकएंड समाधानों के लिए आदर्श बन जाता है। इसकी वास्तुकला सरलता और डेवलपर उत्पादकता पर जोर देती है, जबकि मजबूत प्रदर्शन विशेषताओं को बनाए रखती है।
उपयोग
RESTful APIs का निर्माण
रियल-टाइम बैकएंड सेवाएं बनाना
क्रॉस-प्लेटफॉर्म सर्वर एप्लिकेशन विकसित करना
उच्च-समानांतर कार्यभार का प्रबंधन
Flutter फ्रंटएंड एप्लिकेशन के साथ एकीकरण
मुख्य विशेषताएँ
बहु-थ्रेड आर्किटेक्चर
क्रॉस-प्लेटफ़ॉर्म समर्थन
उच्च प्रदर्शन और स्केलेबिलिटी
निर्मित समानांतरता मॉडल
सरल एपीआई डिज़ाइन
शक्तिशाली त्रुटि संहरण
इनके लिए उपयुक्त
Dart का उपयोग करने वाले बैकएंड विकासकर्मी
पूर्ण-स्टैक Flutter एप्लिकेशन बनाने वाली टीमें
उच्च थ्रूपुट की आवश्यकता वाले प्रोजेक्ट
हल्के सर्वर फ्रेमवर्क की तलाश में विकासकर्ता
क्रॉस-प्लेटफॉर्म डिप्लॉयमेंट की आवश्यकता वाले एप्लिकेशन
विचार योग्य बातें
Dart समानांतरता की समझ आवश्यक है
परिपक्व फ्रेमवर्क की तुलना में सीमित पारिस्थितिकी तंत्र
आधुनिक Dart प्रोजेक्ट्स के लिए सबसे उपयुक्त
उत्पादन डेप्लॉयमेंट के लिए अतिरिक्त टूलिंग की आवश्यकता हो सकती है
सर्वर-पक्ष डार्ट के बारे में अपरिचित शुरुआती लोगों के लिए सीखने का ढलान
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
Fennec is a multi-threaded, robust Dart Server-Side Framework.
Sharing Data between Isolates if using multiples Isolates.
Isolate is an isolated environment, inside which there is memory allocated to it and its EventLoop. but sometimes you want to share Data between Isolates or have the same Data content on all Isolates.
Fennec let you do that by using Actor Concept.
first you need to create your Actor customized class that is a subclass of Actor.
example how to implement it.
classCustomisedActorextendsActor{
finalList<String> _strings = [];
CustomisedActor(String name) : super(name);
@overrideFutureOr<void> execute(String action,
{Map<String, dynamic> data = const {}}) {
if (action == 'insert') {
_strings.add(" new item");
} else {
if (_strings.isNotEmpty) {
_strings.removeLast();
}
}
}
@overrideFutureOrget(String action, {Map<String, dynamic> data = const {}}) {
if (action == "get") {
return _strings;
}
returnnull;
}
}
after implementing of your needed subclasses of [Actor], you need just to add it/them to your [Application] by using addActor or addActors in [Application] instance.
with [ServerContext] instance you can have access to your Actor/Actors by their name and you can call get and execute methods to return some Data from Actor or execute some operations.
you can render also html templates with fennec Framework. you need to determine the path for your
html files. application.setViewPath(path.current + '/example');
WebSocket is already integrated in the core of Framework. firstly to use Websocket . you need to
make the useWebSocket object at [Application] instance true.
Fennec Framework supports also Multithreading over isolates. To increase the number of used isolates
just call the function setNumberOfIsolates. the default number of isolates is 1
example
application.setNumberOfIsolates(1
);
Start your Server and test your first Request
import'package:fennec/fennec.dart';
voidmain(List<String> arguments) async {
Application application = Application();
application.setNumberOfIsolates(1);
application.useWebSocket(true);
application.setPort(8000);
application.addRouters([testRouter()]);
ServerInfo serverInfo = await application.runServer();
print("Server is running at Port ${serverInfo.port}");
}}
deploy
heroku cloud:here is heroku-buildpack
for dart and inside it an example how to deploy Fennec Framework on heroku cloud for free. to test
an example you can try this two endpoints:
Running 1m test @ http://localhost:8000/example/test
10 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 6.50ms 1.27ms 104.08ms 96.71%
Req/Sec 1.55k 124.24 2.41k 87.15%
926903 requests in 1.00m, 180.33MB read
Requests/sec: 15435.91
Transfer/sec: 3.00MB
import information
Fennec Framework after with version >= 1.0.0 doesn't support more annotations because the big
discussions about the library mirrors. as alernatives you can use Route or Route as showed in this
example.