mirror of
https://github.com/timokz/flutter-vienna-hackathon-25.git
synced 2025-11-08 19:04:20 +01:00
43 lines
1.6 KiB
Dart
43 lines
1.6 KiB
Dart
// This is the starting point of your Serverpod server. In most cases, you will
|
|
// only need to make additions to this file if you add future calls, are
|
|
// configuring Relic (Serverpod's web-server), or need custom setup work.
|
|
|
|
import 'package:serverpod/serverpod.dart';
|
|
|
|
import 'src/generated/endpoints.dart';
|
|
import 'src/generated/protocol.dart';
|
|
import 'src/web/routes/root.dart';
|
|
|
|
void run(List<String> args) async {
|
|
// Initialize Serverpod and connect it with your generated code.
|
|
final pod = Serverpod(
|
|
args,
|
|
Protocol(),
|
|
Endpoints(),
|
|
// authenticationHandler: authenticationHandler,
|
|
);
|
|
|
|
// Setup a default page at the web root.
|
|
pod.webServer.addRoute(RouteRoot(), '/');
|
|
pod.webServer.addRoute(RouteRoot(), '/index.html');
|
|
// Serve all files in the /static directory.
|
|
pod.webServer.addRoute(
|
|
RouteStaticDirectory(serverDirectory: 'static', basePath: '/'),
|
|
'/*',
|
|
);
|
|
|
|
// Start the server.
|
|
await pod.start();
|
|
|
|
// After starting the server, you can register future calls. Future calls are
|
|
// tasks that need to happen in the future, or independently of the request/
|
|
// response cycle. For example, you can use future calls to send emails, or to
|
|
// schedule tasks to be executed at a later time. Future calls are executed in
|
|
// the background. Their schedule is persisted to the database, so you will
|
|
// not lose them if the server is restarted.
|
|
|
|
// You can schedule future calls for a later time during startup. But you can
|
|
// also schedule them in any endpoint or webroute through the session object.
|
|
// there is also [futureCallAtTime] if you want to schedule a future call at a
|
|
// specific time.
|
|
}
|