{"id":896,"date":"2023-03-10T16:21:06","date_gmt":"2023-03-10T16:21:06","guid":{"rendered":"https:\/\/s-oneill.com\/sov02\/?p=896"},"modified":"2023-03-10T17:10:08","modified_gmt":"2023-03-10T17:10:08","slug":"js-replit","status":"publish","type":"post","link":"https:\/\/s-oneill.com\/sov02\/js-replit\/","title":{"rendered":"JS-Replit"},"content":{"rendered":"<p>In a recent JS bootcamp course I was introduced to an online testing tool called <strong><a href=\"https:\/\/replit.com\/site\/about\" rel=\"noopener\" target=\"_blank\">replit<\/a> <\/strong>. The interface was a little confusing at first, but I found a <a href=\"https:\/\/www.loom.com\/share\/6fd286c2f5124c8aa2cae7ce2f2d624a?t=12\" rel=\"noopener\" target=\"_blank\">helpful video here<\/a>. To save time, here are the steps outlined in the video for setting up a nodejs and python test environment.<\/p>\n<hr>\n<h4>Creating a nodejs replit<\/h4>\n<p><strong>Steps:<\/strong><\/p>\n<p> &#8211; Create a free account in <a href=\"https:\/\/replit.com\/\" rel=\"noopener\" target=\"_blank\">Replit<\/a> https:\/\/replit.com\/<br \/>\n &#8211; Click <strong>+ Create Repl<\/strong> button (top left corner)<br \/>\n &#8211; Enter in Template field: <strong>blank<\/strong> > and click the <strong>Blank Repl<\/strong> item<br \/>\n &#8211; Enter Title: <strong>nix<\/strong> > and select the <strong>Create Repl<\/strong> button<br \/>\n &#8211; Select <strong>replit.nix<\/strong> in the left menu &#8211; this opens a file showing:<\/p>\n<pre>\r\n{ pkgs }: {\r\n  deps = [\r\n    pkgs.cowsay\r\n  ];\r\n}\r\n<\/pre>\n<p> &#8211; Open a new browser window to <a href=\"https:\/\/search.nixos.org\/packages\" rel=\"noopener\" target=\"_blank\">https:\/\/search.nixos.org\/packages<\/a><br \/>\n &#8211; enter <strong>nodejs<\/strong> > and select the nodejs-18x item > copy <strong>nodejs-18x<\/strong> from the terminal field: <\/p>\n<pre>\r\n  nodejs-18_x\r\n<\/pre>\n<p> &#8211; Go back to the browser for replit.com > and replace the <strong>pkgs.cowsay <\/strong>with:<\/p>\n<pre>\r\n  pkgs.nodejs-18_x\r\n<\/pre>\n<p> &#8211; In the left nav, click <strong>+file<\/strong> icon > name new file <strong>index.js<\/strong> > return<br \/>\n &#8211; In <strong>index.js<\/strong> type: <strong>console.log(&quot;Hello&quot;);<\/strong> \/\/ hit return shows no results<br \/>\n &#8211; Left nav select <strong>.replit<\/strong><br \/>\n &#8211; replace run = &quot;cowsay Configure me!&quot; with<\/p>\n<pre>\r\n  run = \"node index.js\"\r\n<\/pre>\n<p> &#8211; Select <strong>Run<\/strong> button at top and now see &quot;Hello&quot; in right col console.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><strong>Creating a Python replit:<\/strong><br \/>\n(continuing from nodejs steps above)<\/p>\n<p> &#8211; In left nav, click +file icon > name new file main.py > return<br \/>\n &#8211; In main.py type: print(&quot;Hello from Python&quot;)<br \/>\n &#8211; Open new browser window to https:\/\/search.nixos.org\/packages<br \/>\n &#8211; enter &quot;python&quot; > select python38 > copy from terminal field:<br \/>\n\t<strong>python38<\/strong><br \/>\n &#8211; Go back to browser for replit.com > Select left nav  <strong>replit.nix<\/strong><br \/>\n &#8211; Below pkgs.nodejs-18_x enter  <strong>pkgs.python38<\/strong><\/p>\n<pre>\r\n  { pkgs }: {\r\n    deps = [\r\n      pkgs.nodejs-18_x\r\n      pkgs.python38\r\n    ];\r\n  }\r\n<\/pre>\n<p> &#8211; In left nav, Select .replit ><br \/>\n &#8211; replace run = &quot;node index.js&quot; with <\/p>\n<pre>  run = python main.py<\/pre>\n<p> &#8211; Select Run button at top and now see &quot;Hello from Python&quot; in right col console. <\/p>\n<pre>\r\n  \"Hello from Python\" \r\n<\/pre>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>The nix app in replit also allows you to:<br \/>\n<strong>Run both python and js in same the repl<\/strong><br \/>\n(continuing from steps above)<\/p>\n<p> &#8211; in index.js replace console.log(&quot;Hello&quot;) with<\/p>\n<pre>\r\n  const { exec } = require(\"child_process\");\r\n\r\n  exec(\"python main.py\", (error, stdout) => {\r\n    console.log(error || stdout);\r\n    console.log(\"Hello from Javascript\")\r\n  });\r\n<\/pre>\n<p> &#8211; in .replit change run = &quot;python main.py&quot; back to<\/p>\n<pre>\r\n\trun = \"node index.js\"\r\n<\/pre>\n<p> &#8211;  Select run and now see <\/p>\n<pre>\r\n  node index.js\r\n\r\n  Hello from Python\r\n\r\n  Hello from Javascript\r\n<\/pre>\n<p>The console is showing results for both JavaScript and Python<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a recent JS bootcamp course I was introduced to an online testing tool called replit . The interface was a little confusing at first, but I found a helpful video here. To save time, here are the steps outlined in the video for setting up a nodejs and python test environment. Creating a nodejs [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[21,58],"class_list":["post-896","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-javascript","tag-replit"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JS-Replit - s-oneill.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/s-oneill.com\/sov02\/js-replit\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JS-Replit - s-oneill.com\" \/>\n<meta property=\"og:description\" content=\"In a recent JS bootcamp course I was introduced to an online testing tool called replit . The interface was a little confusing at first, but I found a helpful video here. To save time, here are the steps outlined in the video for setting up a nodejs and python test environment. Creating a nodejs [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/s-oneill.com\/sov02\/js-replit\/\" \/>\n<meta property=\"og:site_name\" content=\"s-oneill.com\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-10T16:21:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-10T17:10:08+00:00\" \/>\n<meta name=\"author\" content=\"Me(sean)\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Me(sean)\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/js-replit\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/js-replit\/\"},\"author\":{\"name\":\"Me(sean)\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545\"},\"headline\":\"JS-Replit\",\"datePublished\":\"2023-03-10T16:21:06+00:00\",\"dateModified\":\"2023-03-10T17:10:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/js-replit\/\"},\"wordCount\":386,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a\"},\"keywords\":[\"Javascript\",\"replit\"],\"articleSection\":[\"Javascript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/s-oneill.com\/sov02\/js-replit\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/js-replit\/\",\"url\":\"https:\/\/s-oneill.com\/sov02\/js-replit\/\",\"name\":\"JS-Replit - s-oneill.com\",\"isPartOf\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#website\"},\"datePublished\":\"2023-03-10T16:21:06+00:00\",\"dateModified\":\"2023-03-10T17:10:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/js-replit\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/s-oneill.com\/sov02\/js-replit\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/js-replit\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/s-oneill.com\/sov02\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JS-Replit\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/#website\",\"url\":\"https:\/\/s-oneill.com\/sov02\/\",\"name\":\"s-oneill.com\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/s-oneill.com\/sov02\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a\",\"name\":\"sean o\",\"logo\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/image\/\"},\"description\":\"Web dev over 15 years.\",\"sameAs\":[\"http:\/\/s-oneill.com\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545\",\"name\":\"Me(sean)\",\"url\":\"https:\/\/s-oneill.com\/sov02\/author\/user01\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JS-Replit - s-oneill.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/s-oneill.com\/sov02\/js-replit\/","og_locale":"en_US","og_type":"article","og_title":"JS-Replit - s-oneill.com","og_description":"In a recent JS bootcamp course I was introduced to an online testing tool called replit . The interface was a little confusing at first, but I found a helpful video here. To save time, here are the steps outlined in the video for setting up a nodejs and python test environment. Creating a nodejs [&hellip;]","og_url":"https:\/\/s-oneill.com\/sov02\/js-replit\/","og_site_name":"s-oneill.com","article_published_time":"2023-03-10T16:21:06+00:00","article_modified_time":"2023-03-10T17:10:08+00:00","author":"Me(sean)","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Me(sean)","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/s-oneill.com\/sov02\/js-replit\/#article","isPartOf":{"@id":"https:\/\/s-oneill.com\/sov02\/js-replit\/"},"author":{"name":"Me(sean)","@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545"},"headline":"JS-Replit","datePublished":"2023-03-10T16:21:06+00:00","dateModified":"2023-03-10T17:10:08+00:00","mainEntityOfPage":{"@id":"https:\/\/s-oneill.com\/sov02\/js-replit\/"},"wordCount":386,"commentCount":0,"publisher":{"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a"},"keywords":["Javascript","replit"],"articleSection":["Javascript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/s-oneill.com\/sov02\/js-replit\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/s-oneill.com\/sov02\/js-replit\/","url":"https:\/\/s-oneill.com\/sov02\/js-replit\/","name":"JS-Replit - s-oneill.com","isPartOf":{"@id":"https:\/\/s-oneill.com\/sov02\/#website"},"datePublished":"2023-03-10T16:21:06+00:00","dateModified":"2023-03-10T17:10:08+00:00","breadcrumb":{"@id":"https:\/\/s-oneill.com\/sov02\/js-replit\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/s-oneill.com\/sov02\/js-replit\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/s-oneill.com\/sov02\/js-replit\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/s-oneill.com\/sov02\/"},{"@type":"ListItem","position":2,"name":"JS-Replit"}]},{"@type":"WebSite","@id":"https:\/\/s-oneill.com\/sov02\/#website","url":"https:\/\/s-oneill.com\/sov02\/","name":"s-oneill.com","description":"","publisher":{"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/s-oneill.com\/sov02\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a","name":"sean o","logo":{"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/image\/"},"description":"Web dev over 15 years.","sameAs":["http:\/\/s-oneill.com"]},{"@type":"Person","@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545","name":"Me(sean)","url":"https:\/\/s-oneill.com\/sov02\/author\/user01\/"}]}},"_links":{"self":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts\/896","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/comments?post=896"}],"version-history":[{"count":4,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts\/896\/revisions"}],"predecessor-version":[{"id":900,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts\/896\/revisions\/900"}],"wp:attachment":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/media?parent=896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/categories?post=896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/tags?post=896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}