“Alfred” an express-like server framework written in Dart

Francesco Iapicca
2 min readMar 30, 2021

--

source

After Dart popularity skyrocketed in 2019 (indubitably thanks to Flutter)
I was surprised to see limited interest for its adoption on server side,
fast-forward to 2021 AngularDart is downgraded to internal project
and both angel and aqueduct are deprecated

… what’s the future for Dart on server side?

source

“Hello Alfred”

Already at first sight alfred got my attention:

what’s not to like… enough talk let’s give it a spin!

source

Get Started

follow along these simple steps to create an app really from the scratch

  • Install Dart (don’t forget to update your path)
  • Install Stagehand (run pub global activate stagehand)
  • Create and Move to a folder (mkdir alfredo && cd alfredo)
  • Create a Simple Console App (run stagehand console-simple)
  • Update your pubspec.yaml
name: alfredo
description: A simple command-line application.
environment:
sdk: ‘>=2.12.0 <3.0.0’
dependencies:
alfred: ^0.0.3
  • Update your bin/alfredo.dart
import 'package:alfred/alfred.dart';void main() async {
final app = Alfred();
app.get('/example', (req, res) => 'Hello world');
await app.listen();
print('Listening on port 3000');
}
  • Run the app (run dart run)
  • Open it in your browser (http://localhost:3000/example)

disclosures:
- I’m not affiliated in any way with the alfred project
- It’s my first article on Medium, suggest me how to improve

Follow me on Twitter @yakforward

--

--