HNHacker News
TopNewBestAskShowJobs

adalricus

6 karma · joined January 26, 2020

submissionscomments
adalricus··on Show HN: Cortris – A Simple Url Shortener written in Go
I've implemented these since then, I also read the database file from environment now.
adalricus··on Show HN: Cortris – A Simple Url Shortener written in Go
> it's standard practice to listen for PORT over the environment variable

I didn't think of this, I was thinking of making something like config file where user can specify it. This will be a lot better than that, so I could ask users to set CORTRIS_PORT & read that?

edit: I'm now reading port from environment & setting it to 8080 if it doesn't exist.

> you are opening and closing your DB on every request

I don't understand about controllers part, could I open the db at start & put db.Close() at end of main (?), is there more I have to think of (like what happens after program fails & the connection is still open?)

> http.Error(w, err.Error(), 500)

Is it safe to pass the error to the user? Could something go wrong considering the source is already world readable?

It would be nice if anyone could set it up on heroku free tier, where do I learn about it?

I'm planning on getting a cheap vps to deploy my little projects. Thank you for looking at my project!

adalricus··on Show HN: Cortris – A Simple Url Shortener written in Go
It's nothing fancy, I'm learning how to write programs. This is one of my first projects. I don't have resources to deploy it on the web, the code is short & it really doesn't do much. Previously I used cgi for all my projects, decided to try this reverse-proxy thing this time.

Source Code: https://github.com/adalricus/cortris/

License: ISC License

Images: linked on the page