{"id":67,"date":"2022-02-23T01:21:04","date_gmt":"2022-02-23T01:21:04","guid":{"rendered":"https:\/\/im8bit.com\/?p=67"},"modified":"2022-03-21T17:02:56","modified_gmt":"2022-03-21T17:02:56","slug":"mini-server-using-netcat","status":"publish","type":"post","link":"https:\/\/im8bit.com\/?p=67","title":{"rendered":"Mini server using netcat"},"content":{"rendered":"\n<p>I was trying to run some tests with lighthouse and was looking for the most simple webserver that I could get just to check what the report would look like, so I didn&#8217;t want to run apache locally or a simple nodejs or python script I was looking for the most bare bones thing that I could find and I ended up thinking about netcat and sure enough, it did the job, if you are ever looking for a simple webserver and you don&#8217;t want to install the whole thing for whatever reason you can just use this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>while true; do echo -e \"HTTP\/1.1 200 OK\\r\\n\\n$(date)\" | nc -vlN 8080; done<\/strong><\/code><\/pre>\n\n\n\n<p>This of course will return the date if you visit localhost:8080 but you can change it to do more complex stuff or maybe return the content of a real HTML file, the sky is the limit!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was trying to run some tests with lighthouse and was looking for the most simple webserver that I could get just to check what the report would look like, so I didn&#8217;t want to run apache locally or a simple nodejs or python script I was looking for the most bare bones thing that &#8230; <a class=\"read-more\" href=\"https:\/\/im8bit.com\/?p=67\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-67","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=67"}],"version-history":[{"count":4,"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts\/67\/revisions"}],"predecessor-version":[{"id":100,"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts\/67\/revisions\/100"}],"wp:attachment":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}