Skip to content
Discussion options

You must be logged in to vote

For a plain HTML form, render the form with method: FormMethod.post and handle the POST on the server side.

In server mode, the usual pattern is to mount your Jaspr app behind a shelf_router and add your own POST route before the app route. The jaspr_pad app in this repo does this for its /api endpoints.

Minimal shape:

import 'dart:io';

import 'package:jaspr/server.dart';
import 'package:shelf/shelf.dart';
import 'package:shelf/shelf_io.dart';
import 'package:shelf_router/shelf_router.dart';

import 'main.server.options.dart';

void main() async {
  Jaspr.initializeApp(options: defaultServerOptions);

  final router = Router();

  router.post('/contact', (Request request) async {
    final

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pastelcode
Comment options

Answer selected by pastelcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants