Last active
October 22, 2017 12:24
-
-
Save MatteoRagni/2be84fbece541e2f3f324b3cd8fd4b00 to your computer and use it in GitHub Desktop.
Simple app deployed on Heroku for this Stackoverflow question: https://stackoverflow.com/questions/46873665
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
<h1>Works</h1> |
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
{ | |
"name": "Enigma", | |
"version": "1.0.0", | |
"description": "", | |
"main": "server.js", | |
"scripts": { | |
"start": "node server.js" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC" | |
} |
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
web: node . |
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
'use strict'; | |
const http = require('http'); | |
const fs = require('fs'); | |
const server = http.createServer(function (request, response) { | |
console.log(request.method, request.url); | |
if (request.url == '/style.css'){ | |
const css = fs.readFileSync('style.css', 'utf8'); | |
response.end(css); | |
}else{ | |
const html = fs.readFileSync('index.html', 'utf8'); | |
response.end(html); | |
} | |
}); | |
console.log('port = ', process.env.PORT); | |
server.listen(process.env.PORT || 3000); | |
console.log('Server Started, yay!'); |
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
body {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment