generated from nightlymania/nodejs-express-ejs
Initial commit
commit
71c4ec6d74
|
@ -0,0 +1 @@
|
|||
node_modules/
|
|
@ -0,0 +1,27 @@
|
|||
// Import things
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const server = require('http').createServer(app);
|
||||
const port = process.env.PORT || 3430;
|
||||
|
||||
// Set the templates folder for the thingy
|
||||
app.set('views', __dirname + '/../Templates');
|
||||
app.set('view engine', 'ejs');
|
||||
|
||||
// Makes it so that the Public folder mounts under /
|
||||
app.use(express.static(__dirname + '/../Public'));
|
||||
|
||||
// Main page
|
||||
app.get('/', function(req, res){
|
||||
res.render('index');
|
||||
});
|
||||
|
||||
// Simple way to expose a function
|
||||
exports = module.exports = rws;
|
||||
|
||||
// rws = RunWebServer
|
||||
function rws() {
|
||||
server.listen(port, () => {
|
||||
console.log('✅ Webserver is running ( %d )', port);
|
||||
});
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
#cssloaded {
|
||||
color:deepskyblue;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Hello world!</title>
|
||||
|
||||
<!-- Links -->
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="cssloaded">Hello world!</h1>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,2 @@
|
|||
var rws = require("./Components/webserver.js");
|
||||
rws();
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"ejs": "^3.1.8",
|
||||
"express": "^4.18.1"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue