server_universe 0.0.38 copy "server_universe: ^0.0.38" to clipboard
server_universe: ^0.0.38 copied to clipboard

Server Universe Library For Help you make server rest api on cross platform support edge functions Supabase, Vercel, Netlify, cloud Flare and more

example/README.md

Example #

if you want deploy on device or server or vps, or flutter app try this script

import 'dart:io';
import 'package:general_lib/extension/dynamic.dart';
import 'package:server_universe/native.dart'; 
void main() async {
  print("start");
  int port = int.tryParse(Platform.environment["PORT"] ?? "3000") ?? 3000;
  String host = Platform.environment["HOST"] ?? "0.0.0.0";
  ServerUniverseNative app = ServerUniverseNative(
    serverUniverseLogType: ServerUniverseLogType.debug,
    onNotFound: (request, res) async {
      return res.status(400).send(({
        "@type": "error",
        "message": "path_not_found",
        "description": "PATH: Not Found",
      }.toStringifyPretty()));
    },
  );
  app.all("/", (req, res) {
    return res.status(200).send("oke");
  });

  int count = 0;
  app.all("/version", (req, res) async {
    count++;
    return await res.status(200).send("\nCOUNT: ${count}");
  });
  await app.listen(port:port, bindIp: host); 
  print("Server on");
}
32
likes
150
points
937
downloads
screenshot

Publisher

unverified uploader

Weekly Downloads

Server Universe Library For Help you make server rest api on cross platform support edge functions Supabase, Vercel, Netlify, cloud Flare and more

Homepage
Repository (GitHub)
View/report issues

Topics

#server #socket #api #backend #network

Documentation

Documentation
API reference

Funding

Consider supporting this project:

github.com
github.com

License

Apache-2.0 (license)

Dependencies

collection, general_lib, http, mime, path, web, yaml

More

Packages that depend on server_universe