server_nano 1.5.1 copy "server_nano: ^1.5.1" to clipboard
server_nano: ^1.5.1 copied to clipboard

A light, very fast, and friendly http and websocket server written in dart.

example/README.md

import 'package:server_nano/server_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.ws('/socket', (socket) {
    socket.onMessage((message) {
      print(message);
    });

    socket.join('tech-group');

    socket.emitToRoom(
        'connected', 'tech-group', 'User connected to tech-group');
  });

  server.listen(port: 3000, wsPort: 3001);
}
13
likes
150
pub points
73%
popularity

Publisher

unverified uploader

A light, very fast, and friendly http and websocket server written in dart.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

mime, path

More

Packages that depend on server_nano