endeavor 1.0.1 endeavor: ^1.0.1 copied to clipboard
Endeavor is a web framework written in Dart programming language and is inspired by frameworks like [Ruby on Rails](https://rubyonrails.org), and [Express Js](https://expressjs.com). The goal of Endea [...]
// example.dart
import 'package:endeavor/endeavor.dart';
void main() async {
final app = Endeavor();
// Html response
app.GET('/', (Request req, Response res){
res.HTML(
'''
<!doctype html>
<html>
<body>
<form action="/download" method="post" enctype="multipart/form-data">
<input type="file" name="file" /><br />
<button type="submir">Save</button>
</form>
</body>
</html>
'''
);
});
// Get POST data
app.POST('/', (Request req, Response res) async {
print(await req.body());
});
// Download a html form upload file
app.POST('/download', (Request req, Response res) async {
req.DownloadFile();
});
await app.runServer();
}
// controller
class RootController{
home(Request req, Response res) async {
res.sendString('T daa');
}
}