{"id":30273,"date":"2023-02-06T13:26:30","date_gmt":"2023-02-06T21:26:30","guid":{"rendered":"https:\/\/coderpad.io\/?post_type=programming-language&#038;p=30273"},"modified":"2023-03-31T11:14:51","modified_gmt":"2023-03-31T18:14:51","slug":"gin","status":"publish","type":"programming-language","link":"https:\/\/coderpad.io\/languages\/gin\/","title":{"rendered":"Gin"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Running Gin + PostgreSQL in CoderPad Interview<\/strong><\/h2>\n\n\n\n<p>This pad is running a Go-based <a href=\"https:\/\/gin-gonic.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Gin<\/a> application, with a built-in connection to a <a href=\"https:\/\/www.postgresql.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">PostgreSQL<\/a> database. We&#8217;ve also installed <a href=\"https:\/\/gorm.io\/docs\/\" target=\"_blank\" rel=\"noreferrer noopener\">gorm<\/a>, which is an ORM tool to make it easy to interact with the database. &nbsp;Changes are automatically applied as you type them, and you can add as many files to the project as you need.<\/p>\n\n\n\n<p>To get started, edit the <code>main.go<\/code> file, and query your API to see the response.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Accessing your API<\/strong><\/h2>\n\n\n\n<p>We&#8217;ve installed <a href=\"https:\/\/curl.se\/\" target=\"_blank\" rel=\"noreferrer noopener\"><code>curl<\/code><\/a> in the container running your application, so you can make requests to your API directly from the shell. For instance, you can run <code>curl 127.0.0.1:3000\/users<\/code> to see your server&#8217;s output.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>IntelliSense<\/strong><\/h2>\n\n\n\n<p>IntelliSense is running across your entire project, allowing you to see when there are syntax errors or to get quick hints for how to resolve errors or Go issues.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Shell<\/strong><\/h2>\n\n\n\n<p>A shell is provided to you so you can inspect your container in more detail. &nbsp;The shell can be used to install Go packages using <code>go get &lt;package&gt;<\/code>. &nbsp;In addition to installing packages, the shell can be used for executing a test suite if you have one defined.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>\u26a0\ufe0f While it&#8217;s possible to edit files directly from the shell, we recommend using the editor to make your changes. &nbsp;That way, other people in the pad can see your changes as they&#8217;re being made.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Container Limits<\/strong><\/h2>\n\n\n\n<p>The container running your application has a few limitations. &nbsp;Currently, we don&#8217;t limit your CPU usage, though this may change in future. &nbsp;In addition to CPU, we monitor the network bandwidth that is consumed, and limit you to 75 MB for the duration of the container. &nbsp;Finally, we limit the amount of memory accessible to each container to 0.5 GB.<\/p>\n","protected":false},"parent":0,"menu_order":0,"template":"","class_list":["post-30273","programming-language","type-programming-language","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/programming-language\/30273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/programming-language"}],"about":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/types\/programming-language"}],"wp:attachment":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/media?parent=30273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}