Compare commits
2 Commits
907b0ef307
...
f6db8a8969
Author | SHA1 | Date | |
---|---|---|---|
|
f6db8a8969 | ||
|
d04c7a9ab6 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules/
|
35
Components/webserver.js
Normal file
35
Components/webserver.js
Normal file
@ -0,0 +1,35 @@
|
||||
// Import things
|
||||
const express = require('express');
|
||||
const { is } = require('express/lib/request');
|
||||
const res = require('express/lib/response');
|
||||
const app = express();
|
||||
const path = require('path');
|
||||
const server = require('http').createServer(app);
|
||||
const port = process.env.PORT || 3430;
|
||||
var fs = require('fs');;
|
||||
|
||||
// Database for the demo site,
|
||||
var demoDB = [
|
||||
{
|
||||
name: "Poggere"
|
||||
}
|
||||
];
|
||||
|
||||
// Use /Public as the path for css and such
|
||||
app.set('views', __dirname + '/../Templates');
|
||||
app.set('view engine', 'ejs');
|
||||
app.use(express.static(__dirname + 'Public'));
|
||||
|
||||
// Main page
|
||||
app.get('/', function(req, res){
|
||||
res.render('app', {site:1, db: demoDB});
|
||||
});
|
||||
|
||||
// Simple way to expose a function
|
||||
exports = module.exports = rws;
|
||||
|
||||
function rws() {
|
||||
server.listen(port, () => {
|
||||
console.log('✅ Webserver is running ( %d )', port);
|
||||
});
|
||||
};
|
1
Templates/app.ejs
Normal file
1
Templates/app.ejs
Normal file
@ -0,0 +1 @@
|
||||
<h1>Hello world!!!</h1>
|
3
index.js
3
index.js
@ -1 +1,2 @@
|
||||
include("./webserver.js")
|
||||
var rws = require("./Components/webserver.js");
|
||||
rws();
|
1292
package-lock.json
generated
Normal file
1292
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
6
package.json
Normal file
6
package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"ejs": "^3.1.8",
|
||||
"express": "^4.18.1"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user