Vercel Request Properties
When using the vercel_edge
package, you can access a number of request properties about the incoming request, such as the users geolocation and IP address via the vc
property:
import 'package:vercel_edge/vercel_edge.dart';
void main() {
VercelEdge(fetch: (request) {
print('IP Adress: ${request.vc.ipAddress}');
print('City: ${request.vc.city}');
print('Country: ${request.vc.country}');
print('Region: ${request.vc.region}');
print('Country Region: ${request.vc.countryRegion}');
print('Latitude: ${request.vc.latitude}');
print('Longitude: ${request.vc.longitude}');
return Response("Hello, you are visiting from ${request.vc.city}!");
});
}