Skip to main content

anek 0.0.1 copy "anek: ^0.0.1" to clipboard
anek: ^0.0.1 copied to clipboard

A high-performance, multi-core Dart web framework featuring an Express.js-style API, deterministic graceful shutdowns, and O(K) Radix Tree routing.

example/example.dart

import 'package:anek/anek.dart';

// Mock authentication middleware
Future<void> requireAuth(AnekRequest req, AnekResponse res, NextFunction next) async {
  bool hasToken = false; 
  
  if (!hasToken) {
    return res.json({'error': 'Unauthorized! Token missing.'}, status: 401);
  }
}

void setupRoutes(RadixRouter app) {
  app.get('/home', (req, res) {
    res.json({'message': 'Welcome to the public home page'});
  });

  app.get('/dashboard', (req, res) {
    res.json({'message': 'Welcome to the highly secure admin dashboard'});
  }, [requireAuth]);
}

void main() async {
  await HyperServer.listen(
    port: 3000,
    routeBuilder: setupRoutes,
  );
}
1
likes
150
points
382
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A high-performance, multi-core Dart web framework featuring an Express.js-style API, deterministic graceful shutdowns, and O(K) Radix Tree routing.

Repository (GitHub)

License

MIT (license)

Dependencies

path

More

Packages that depend on anek