Questions tagged [dart-shelf]

Shelf is a web server middleware for Dart. Shelf makes it easy to create and compose web servers and parts of web servers.

This tag is for questions about shelf and shelf extension packages.

Shelf makes it easy to create and compose web servers and parts of web servers. How?

50 questions
2
votes
2 answers

Dart shelf_web_socket with shelf_router gives Hijack exception

I am trying to implement a basic server which serves both websockets and http requests. Code is this; import 'package:shelf_router/shelf_router.dart'; import 'package:shelf/shelf.dart'; import 'package:shelf/shelf_io.dart' as io; import…
ZayX
  • 160
  • 1
  • 8
2
votes
1 answer

How to get the client IP in a dart shelf-rpc server

I have a dart web service application written with Shelf and Rpc apis. I need to check the client Ip inside my api methods, but I cannot figure how. The context method does not contain the HttpRequest .contentInfo property. More, also the shelf…
J F
  • 1,058
  • 2
  • 10
  • 21
2
votes
1 answer

Dart: Add a middleware to parse to JSON work with shelf_rest

I've created a function that converts a model into JSON using mirror. Map convertObjectToJson(Object obj); dynamic convertJsonToObject(Map json, Type type); I wish to use it so that my models/view-models are converted back and forth between…
Kayes
  • 502
  • 7
  • 18
2
votes
0 answers

Authenticate websocket connection in Dart using shelf_auth and shelf_web_socket

Using shelf_auth I can extract current user information from request this way: getAuthenticatedContext(request) .map((ac) => ac.principal.name) .getOrElse(() => 'guest') but, obviously, I need a request for that to work :) On the other hand,…
Mike
  • 738
  • 8
  • 12
2
votes
1 answer

AngularDart Transformation/Deployments

I am building a client/server app in Dart using Angular for the front-end and Shelf on the backend. When I do a pub build it generates the javascript for the Dart files as expected but is does not replace the dart references in my HTML files. So in…
Gus
  • 649
  • 5
  • 14
1
vote
1 answer

SocketException when trying to access to a mysql docker container from shelf server container

Context I am trying to create a Dart server with the library shelf. I want it a bit scalable in order to get to production when my project will be ready. And to facilitate the production release, I decided to use Docker in order to deploy it…
Mathieu
  • 1,435
  • 3
  • 16
  • 35
1
vote
1 answer

How to get the IP address of the user with shelf in dart server side?

In general, I can get the IP address of the request sender by: import 'dart:io'; Future main() async { final server = await HttpServer.bind(InternetAddress.anyIPv4, 8080); print('Server listening on ${server.address}'); await for (var…
1
vote
1 answer

How to send request to another server in shelf dart

I need to make a request to my firebase rtdb from my shelf server hosted on 127.0.0.1, I have the url and the db secrets. But whenever i try to make a get request to the db url using the http package, i get a 401 error. My code: import…
Joel
  • 239
  • 3
  • 21
1
vote
1 answer

How can I cancel/abort a zone in Dart?

I have an http web server that I'm trying to detect long-running requests and abort them. The following code successfully returns to the client upon timeout, but the async zone still continues to run to completion. How can I actually kill the…
KOGI
  • 3,959
  • 2
  • 24
  • 36
1
vote
1 answer

Angular Dart - How to create a proxy server for angular dart apps?

I would like to create a proxy server for my angular-dart applications that redirects me to index.html whenever I refresh the browser and the route is different from root. For example, if the url is: http://localhost:8080/users and I hit refresh…
Luis Vargas
  • 2,466
  • 2
  • 15
  • 32
1
vote
1 answer

How do i support client side routing using dart and angular 2?

I'm trying to run Angular2 alpha 35 I have a server setup with a static shelf server. It works fine for publishing to heroku after pub build. When i use pub serve to test locally, i don't seem to have control over routing, and i need more granular…
Jack Murphy
  • 2,952
  • 1
  • 30
  • 49
1
vote
1 answer

incompatibility when running dart rpc and shelf (with shelf_rpc) related to headers which are lists (and not Strings)

incompatibility when running dart rpc and shelf (with shelf_rpc) related to headers which are lists (and not Strings). It seems that there is an incompatibility when running dart rpc and shelf (with shelf_rpc) related to headers which are lists…
Benjamin
  • 275
  • 2
  • 8
1
vote
1 answer

Incompatibility between the Dart shelf and rpc packages? ('access-control-request-method' header)

There seems to be an incompatibility between the shelf and rpc packages. In rpc [0.4.1] config/api.dart: The handleHttpOptionsRequest expects the 'access-control-request-method' header to be a List: Future
Benjamin
  • 275
  • 2
  • 8
1
vote
2 answers

How to serve a polymer application from dart shelf static file handler?

I'm trying to serve a polymer application using a shelf static server. I create next structure: polymerapp - pubspec.yml - bin - server.dart - web - index.html - lib - main_app.dart …
Luis Vargas
  • 2,466
  • 2
  • 15
  • 32
1
vote
2 answers

How do I validate an established session using the shelf_auth library?

I've been trying to write a simple server that accepts username/password credentials, validates them, then creates a JWT token for the client that they then use to gain access to certain routes. I am able to do everything up to the point of…