Last active
February 15, 2020 18:26
-
-
Save atifazad/95d6a496118be8e9a2f9f3047f47127a to your computer and use it in GitHub Desktop.
Hello World! in various languages and frameworks (embedded in https://atifazad.com/tutorials/general/hello-world/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This gist contains Hello World examples for several programming languages and framworks. This codes from this gist are being used (as embed code) at Hello World page at my weebsite (https://atifazad.com/tutorials/general/hello-world/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
print("Hello World!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// write to console | |
console.log("Hello World!"); | |
// show a browser alert with text hello world | |
alert("Hello World!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php echo "Hello World!"; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Hello World!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "Hello World!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "Hello World!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Execute in Xcode playground | |
print("Hello World!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Assuming you've already installed Nodejs and Express JS | |
* If not, please follow: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/development_environment | |
* | |
*/ | |
var express = require('express'); | |
var app = express(); | |
const hostname = "127.0.0.1"; | |
const port = 3000; | |
app.get('/', function(req, res) { | |
res.send("Hello World!"); | |
}); | |
app.listen(port, hostname, () => { | |
console.log(`Server running at http://${hostname}:${port}/`); | |
}); | |
/** | |
* Save above code in a file 'app.js' and execute following command in console | |
* while you're in your app directory. | |
*/ | |
> node app.js | |
/** | |
* You should see "Server running at http://127.0.0.1:3000" in console and... | |
* Hit 127.0.0.1:3000 in your browser, you should see Hello World! in browser. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Assuming you've already installed Nodejs | |
*/ | |
// Load HTTP module | |
const http = require("http"); | |
const hostname = "127.0.0.1"; | |
const port = 3000; | |
// Create HTTP server | |
const server = http.createServer((req, res) => { | |
// Set the response HTTP header with HTTP status and Content type | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
// Send the response body "Hello World!" | |
res.end("Hello World!n"); | |
}); | |
// Prints a log once the server starts listening | |
server.listen(port, hostname, () => { | |
console.log("Server running at http://${hostname}:${port}/"); | |
}) | |
/** | |
* Save above code in a file 'app.js' and execute following command in console | |
* while you're in your app directory. | |
*/ | |
> node app.js | |
/** | |
* You should see "Server running at http://127.0.0.1:3000" in console and... | |
* Hit 127.0.0.1:3000 in your browser, you should see Hello World! in browser. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment