server_nano_nano 1.0.1 server_nano_nano: ^1.0.1 copied to clipboard
A super light http server written in dart. All credits to https://github.com/jonataslaw/dart-server-nano
import 'package:server_nano/server_nano_nano.dart';
void main() {
final server = Server();
server.get('/', (req, res) {
res.sendJson({'Hello': 'World!'});
});
server.get('/user/:id', (req, res) async {
await Future.delayed(Duration(seconds: 2));
res.send('Hello User ${req.params['id']}!');
});
server.listen(port: 3000);
}