Hacker News new | past | comments | ask | show | jobs | submit login

I had the same questions, so I went ahead and prototyped a tiny API in Go: https://github.com/melvinmt/translation.io

Building an API in Go feels -very- robust because of the strong typing and the strict compiler. After a while you'll discover the strength of interfaces and be pleasantly surprised. Combined with the performance boost, I can't think of a better language to write an API in.




FYI, you should replace DocsHandler with net/http's FileServer.

Reasons: 1) the implementation is not vulnerable to path traversal attacks (i.e. if url.Path == "/../../../../../etc/passwd"). 2) It automatically handles index.html 3) It uses "/etc/mime.types" and other system files to automatically set mime types 4) It streams the file back instead of reading it all into memory.


Thanks! Didn't know about Fileserver. I'll look into it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: