{"id":18974,"date":"2022-09-20T18:00:00","date_gmt":"2022-09-21T01:00:00","guid":{"rendered":"https:\/\/coderpad.io\/?post_type=programming-language&#038;p=18974"},"modified":"2023-04-17T03:59:50","modified_gmt":"2023-04-17T10:59:50","slug":"node","status":"publish","type":"programming-language","link":"https:\/\/coderpad.io\/languages\/node\/","title":{"rendered":"Node"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Running Express + PostgreSQL on CoderPad<\/strong><\/h2>\n\n\n\n<p>This Node pad is running an <a href=\"https:\/\/expressjs.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Express<\/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:\/\/sequelize.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Sequelize<\/a>, which is a promise-based 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<h2 class=\"wp-block-heading\"><strong>Accessing your API<\/strong><\/h2>\n\n\n\n<p>We&#8217;ve installed <code><a href=\"https:\/\/curl.se\/\" target=\"_blank\" rel=\"noreferrer noopener\">curl<\/a><\/code> in the container running your application, so you can make requests to your API directly from the shell. &nbsp;For instance, you can run <code>curl 127.0.0.1:3000\/test<\/code> to see your server&#8217;s output.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>TypeScript<\/strong><\/h2>\n\n\n\n<p>The app is pre-configured to support <a href=\"https:\/\/www.typescriptlang.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">TypeScript<\/a>, but you can define <code>.js<\/code> files instead if you prefer. &nbsp;Compilation and type checks are handled by <a href=\"https:\/\/swc.rs\/\" target=\"_blank\" rel=\"noreferrer noopener\">SWC<\/a>, a <a href=\"https:\/\/www.rust-lang.org\/\" target=\"_blank\" rel=\"noopener\">Rust<\/a>-based platform for compilation and bundling that greatly decreases compilation time.<\/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 TypeScript 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 <a href=\"https:\/\/www.npmjs.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">NPM<\/a> packages using <code>npm install &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\ufe0fWhile 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-18974","programming-language","type-programming-language","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/coderpad.io\/wp-json\/wp\/v2\/programming-language\/18974","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=18974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}