zeno 0.1.0 copy "zeno: ^0.1.0" to clipboard
zeno: ^0.1.0 copied to clipboard

A hot reload utility for Dart Applications

example/lib/main.dart

import 'dart:io';

import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart' as shelf_io;
import 'package:shelf_router/shelf_router.dart';

void main() async {
  // print('🎯 Starting example Dart application÷...');

  final router = Router();

  router.get('/', (Request request) {
    return Response.ok(
      '''
<!DOCTYPE html> 
<html> 
<head>
    <title>Zoo Example</title>
</head>
<body>
    <h1>Running main.dart</h1> 
</body>
</html>
    ''',
      headers: {'Content-Type': 'text/html'},
    );
  });

  router.get('/api/hello', (Request request) {
    return Response.ok(
      '{"message": "Hello from Dart Air!", "timestamp": "${DateTime.now().toIso8601String()}"}',
      headers: {'Content-Type': 'application/json'},
    );
  });  
 
  router.get('/api/time', (Request request) {
    final now = DateTime.now();
    return Response.ok(
      '{"time": "${now.toIso8601String()}", "unix": ${now.millisecondsSinceEpoch}}',
      headers: {'Content-Type': 'application/json'},
    );
  });

  final handler = Pipeline()
      .addMiddleware(logRequests())
      .addHandler(router.call);

  const port = 3000;
  await shelf_io.serve(handler, InternetAddress.anyIPv4, port);
 
  print('✅ Server running on http://localhost:$port');
  print('📂 Document root: ${Directory.current.path}');
}
1
likes
150
points
98
downloads

Publisher

verified publisherinfms.dev

Weekly Downloads

A hot reload utility for Dart Applications

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

args, cli_completion, mason_logger, path, pub_updater, shelf, shelf_router, watcher, yaml

More

Packages that depend on zeno