Skip to content

A microservice for creating google docs as the authenticated user.

Notifications You must be signed in to change notification settings

adventures-in/create_gdocs_microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create_gdocs_microservice

A microservice for creating google docs as the authenticated user.

Notes

Description

Sending a HTTP GET request to ... with a json payload of ... results in ...

Simulate a hosted environment with Docker

$ docker build -t create_gdocs .
...

$ docker run -it -p 8080:8080 --name app create_gdocs
Listening on :8080

From another terminal:

curl http://localhost:8080

Testing

Running tests

$ dart test
00:02 +1: All tests passed!

Prototyping

Run the function locally

$ dart run bin/server.dart
Listening on :8080

Interact with the locally running function

From another terminal, send a JSON request:

$ curl -X POST -H "content-type: application/json" -d '{ "name": "World" }' -i localhost:8080
HTTP/1.1 200 OK
date: Sat, 19 Dec 2020 02:17:42 GMT
content-length: 37
x-frame-options: SAMEORIGIN
content-type: application/json
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
server: dart:io with Shelf

{"salutation":"Hello","name":"World"}

Tools like [curl] (and [postman]) are good for sending HTTP requests. The options used in this example are:

  • -X POST - send an HTTP POST request
  • -H "content-type: application/json" - set an HTTP header to indicate that the body is a JSON document
  • -d '{ "name": "World" }' - set the request body to a JSON document
  • -i - show the response headers (to confirm the response body content type is also a JSON document)

The last line, separated by a blank line, prints the response body.

About

A microservice for creating google docs as the authenticated user.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published