diff options
| author | Andrew Lee <alee14498@gmail.com> | 2019-08-02 12:06:56 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@gmail.com> | 2019-08-02 12:06:56 -0400 |
| commit | f7c360592b6c2ef24b033280aa977a894349476a (patch) | |
| tree | d057e242caccb73f02ec37c3693317a638fb356a | |
| parent | ab197dc41a884902625aff031cf0df089b8065b6 (diff) | |
| download | alp-website-f7c360592b6c2ef24b033280aa977a894349476a.tar.gz alp-website-f7c360592b6c2ef24b033280aa977a894349476a.tar.bz2 alp-website-f7c360592b6c2ef24b033280aa977a894349476a.zip | |
Finally making some progress on the website
| -rw-r--r-- | .idea/.gitignore | 3 | ||||
| -rw-r--r-- | .idea/Alee Productions Website.iml | 12 | ||||
| -rw-r--r-- | .idea/jsLibraryMappings.xml | 6 | ||||
| -rw-r--r-- | .idea/misc.xml | 6 | ||||
| -rw-r--r-- | .idea/modules.xml | 8 | ||||
| -rw-r--r-- | .idea/vcs.xml | 6 | ||||
| -rw-r--r-- | .vscode/launch.json | 24 | ||||
| -rw-r--r-- | app.js | 58 | ||||
| -rw-r--r-- | package-lock.json | 5 | ||||
| -rw-r--r-- | package.json | 1 | ||||
| -rw-r--r-- | public/css/style.css | 5 | ||||
| -rw-r--r-- | routes/index.js | 8 | ||||
| -rw-r--r-- | views/404.ejs | 10 | ||||
| -rw-r--r-- | views/includes/footer.ejs | 1 | ||||
| -rw-r--r-- | views/includes/header.ejs | 3 | ||||
| -rw-r--r-- | views/includes/navbar.ejs | 12 | ||||
| -rw-r--r-- | views/index.ejs | 12 | ||||
| -rw-r--r-- | views/wev2.ejs | 1 |
18 files changed, 163 insertions, 18 deletions
diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..0e40fe8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ + +# Default ignored files +/workspace.xml
\ No newline at end of file diff --git a/.idea/Alee Productions Website.iml b/.idea/Alee Productions Website.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/Alee Productions Website.iml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="WEB_MODULE" version="4"> + <component name="NewModuleRootManager"> + <content url="file://$MODULE_DIR$"> + <excludeFolder url="file://$MODULE_DIR$/.tmp" /> + <excludeFolder url="file://$MODULE_DIR$/temp" /> + <excludeFolder url="file://$MODULE_DIR$/tmp" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..d23208f --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="JavaScriptLibraryMappings"> + <includedPredefinedLibrary name="Node.js Core" /> + </component> +</project>
\ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="JavaScriptSettings"> + <option name="languageLevel" value="ES6" /> + </component> +</project>
\ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..26c8816 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/Alee Productions Website.iml" filepath="$PROJECT_DIR$/.idea/Alee Productions Website.iml" /> + </modules> + </component> +</project>
\ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project>
\ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..ac269da --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "program": "${workspaceFolder}/app.js" + }, + { + "type": "node", + "request": "launch", + "name": "Debug", + "runtimeExecutable": "nodemon", + "program": "${workspaceFolder}/app.js", + "restart": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + } + ] +}
\ No newline at end of file @@ -18,11 +18,15 @@ **************************************/ const express = require('express'); +const app = express(); const moment = require('moment'); -let app = express(); -const config = require("./config.json") -const webhook = require("webhook-discord") -const Hook = new webhook.Webhook(config.durl) +const readline = require("readline"); +const path = require("path"); +const config = require("./config.json"); +const webhook = require("webhook-discord"); +const Hook = new webhook.Webhook(config.durl); + +const port = 4000; const logger = (req, res, next) => { console.log( @@ -33,22 +37,46 @@ const logger = (req, res, next) => { next(); }; -console.log("Starting up Website...") + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout + }); + + rl.on("line", (input) => { + switch (input) { + case "clear": + console.clear(); + break; + case "exit": + async function exitWebsite() { + console.log("[i] Closing website..."); + await Hook.info("Alee Productions Website","Website is shutting down..."); + process.exit(0); + } + exitWebsite(); + break; + default: + console.log("[X] Error: Command not found. Use clear or exit."); + break; + } + }); + +console.log("[i] Starting up Website...") app.set('view engine', 'ejs'); +app.set("views", path.join(__dirname, "views")); +app.use(express.static(path.join(__dirname, "public"))); + app.use(logger) -app.get('/', (req, res) => { - res.render('index', {title: 'Alee Production Website'}); -}); +app.use("/", require("./routes/index")); -app.get('/', function (req, res) { - Hook.success("Alee Productions Website", Error) - throw new Error('BROKEN') // Express will catch this on its own. - }) +app.use((req, res) => { + res.status(404).render("404", {title: "404 | Alee Productions"}); +}); -app.listen(4000, () => { +app.listen(port, () => { //Hook.success("Alee Productions Website","Website has been loaded!") -console.log('Website listening on port 4000!' -)});
\ No newline at end of file +console.log(`[>] Website listening on port ${port}!`) +});
\ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 9f76129..a1b883a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2196,6 +2196,11 @@ "readable-stream": "^2.0.2" } }, + "readline": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/readline/-/readline-1.3.0.tgz", + "integrity": "sha1-xYDXfvLPyHUrEySYBg3JeTp6wBw=" + }, "regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", diff --git a/package.json b/package.json index 021b5f7..b358b1e 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "ejs": "^2.6.2", "express": "^4.17.1", "moment": "^2.24.0", + "readline": "^1.3.0", "webhook-discord": "^3.2.0" }, "devDependencies": { diff --git a/public/css/style.css b/public/css/style.css new file mode 100644 index 0000000..c67b395 --- /dev/null +++ b/public/css/style.css @@ -0,0 +1,5 @@ +body { + font-family: Play, sans-serif; + background-color: #212121; + color: #ffffff; +}
\ No newline at end of file diff --git a/routes/index.js b/routes/index.js new file mode 100644 index 0000000..b12714e --- /dev/null +++ b/routes/index.js @@ -0,0 +1,8 @@ +const express = require("express"); +const router = express.Router(); + +router.get('/', (req, res) => { + res.render('index', {title: 'Home | Alee Productions'}); + }); + +module.exports = router;
\ No newline at end of file diff --git a/views/404.ejs b/views/404.ejs new file mode 100644 index 0000000..2bcc58e --- /dev/null +++ b/views/404.ejs @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <% include ./includes/header %> + <title><%= title %></title> +</head> +<body> + <h1>404 - Not Found</h1> +</body> +</html>
\ No newline at end of file diff --git a/views/includes/footer.ejs b/views/includes/footer.ejs new file mode 100644 index 0000000..8a666f5 --- /dev/null +++ b/views/includes/footer.ejs @@ -0,0 +1 @@ +<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
\ No newline at end of file diff --git a/views/includes/header.ejs b/views/includes/header.ejs new file mode 100644 index 0000000..268e2d4 --- /dev/null +++ b/views/includes/header.ejs @@ -0,0 +1,3 @@ +<link href="https://fonts.googleapis.com/css?family=Play:400,700&display=swap" rel="stylesheet"> +<link rel="stylesheet" href="/css/style.css"> +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
\ No newline at end of file diff --git a/views/includes/navbar.ejs b/views/includes/navbar.ejs new file mode 100644 index 0000000..634ee5a --- /dev/null +++ b/views/includes/navbar.ejs @@ -0,0 +1,12 @@ +<div class="navbar-fixed"> +<nav> + <div class="nav-wrapper black"> + <a href="/" class="brand-logo">Alee Productions</a> + <ul id="nav-mobile" class="right hide-on-med-and-down"> + <li><a href="/projects">Projects</a></li> + <li><a href="/blog">Blog</a></li> + <li><a href="/about">About</a></li> + </ul> + </div> +</nav> +</div>
\ No newline at end of file diff --git a/views/index.ejs b/views/index.ejs index d809250..80605ce 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -1,4 +1,12 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <% include ./includes/header %> + <title><%= title %></title> +</head> <body> - <h1>Hello World!</h1> - <a href ="wev2.ejs">Hello</a> + <% include ./includes/navbar %> + <h1>This page is under construction</h1> + <% include ./includes/footer %> </body> +</html>
\ No newline at end of file diff --git a/views/wev2.ejs b/views/wev2.ejs deleted file mode 100644 index 6f9f642..0000000 --- a/views/wev2.ejs +++ /dev/null @@ -1 +0,0 @@ -<h1>Hello 2</h1>
\ No newline at end of file |
