Skip to content

vaibhavppandey/location_shelf_api_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A server app built using Shelf, configured to enable running with Docker.

This code handles HTTP GET requests to /, /test/<message> and /location w/ optional boolean field random.

Running api server

Running with the Dart SDK

You can run the example with the Dart SDK like this:

$ dart run bin/server.dart
Server listening on port 8080 and host localhost

And then from a second terminal:

$ curl http://localhost:8080
Hello, World!
$ curl http://localhost/location?random=true
{"ip":"200.53.20.122","location":"Brazil"}

You should see the logging printed in the first terminal:

2021-05-06T15:47:04.620417  0:00:00.000158 GET     [200] /
2021-05-06T15:47:08.392928  0:00:00.001216 GET     [200] /location?random=true

About

Api server to get location, in dart

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published