Quick implementation of the wordcount-api, for frontend candidates to test against
123
A quick implementation of the wordcount-api in Go.
Scans over the incoming request buffer directly to avoid reading the entire file into memory at once.
Example:
$ curl -i -F "file=@./testdata/hadoop.txt;filename=hadoop.txt" http://localhost:8000/upload
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Content-Type: application/json
Date: Mon, 06 Aug 2018 19:54:31 GMT
Content-Length: 503
{"total":72,"counts":{"a":2,"an":3,"and":4,"anything":1,"are":1,"at":1,"bad":1,"because":1,"but":1,"cling":1,"core":1,"data":1,"does":1,"elegant":2,"element":1,"elephant":3,"extraneous":1,"fellow":1,"forgets":1,"gentle":1,"gets":1,"group":1,"hadoop":3,"hdfs":1,"he":3,"helps":1,"him":1,"his":1,"hive":1,"impala":1,"in":1,"is":4,"king":2,"lets":1,"mad":1,"mellow":1,"never":2,"or":2,"plays":1,"sqoop":1,"the":3,"thing":1,"thrive":1,"to":1,"useful":1,"well":1,"what":1,"with":1,"wonderful":1,"yellow":2}}
Content type
Image
Digest
Size
4.6 MB
Last updated
about 8 years ago
docker pull openlaw/wordcount-api