Expressify

main
Keir Finlow-Bates 2 years ago
parent 5a9a003191
commit afa4cb92d7

145
.gitignore vendored

@ -0,0 +1,145 @@
# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
database.txt
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
### Node Patch ###
# Serverless Webpack directories
.webpack/
# Optional stylelint cache
# SvelteKit build / generate output
.svelte-kit
# End of https://www.toptal.com/developers/gitignore/api/node

@ -0,0 +1,19 @@
{
"name": "nomath",
"version": "1.0.0",
"description": "Arcana by HTML5 UP\r html5up.net | @ajlkn\r Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://gitea.blockchaingandalf.com/kf106/NoMath.git"
},
"author": "kf106",
"license": "MIT",
"dependencies": {
"body-parser": "^1.20.2",
"express": "^4.18.2"
}
}

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before

Width:  |  Height:  |  Size: 730 KiB

After

Width:  |  Height:  |  Size: 730 KiB

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Before

Width:  |  Height:  |  Size: 898 KiB

After

Width:  |  Height:  |  Size: 898 KiB

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

@ -155,8 +155,8 @@
</ul>
</section>
<section class="col-6 col-12-narrower">
<h3>Don't Get In Touch</h3>
<form>
<h3>Get In Touch</h3>
<form method="post" action="/subscribe">
<div class="row gtr-50">
<div class="col-6 col-12-mobilep">
<input type="text" name="name" id="name" placeholder="Name" />
@ -169,7 +169,7 @@
</div>
<div class="col-12">
<ul class="actions">
<li><input type="button" class="button alt" value="Send Message" onClick="alert('Come on, I told you it doesn\'t work')"/></li>
<li><input type="submit" value="Send Message" /></li>
</ul>
</div>
</div>

@ -0,0 +1,64 @@
<!DOCTYPE HTML>
<!--
Arcana by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title>The No Math Revolution Starts Here</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="assets/css/main.css" />
</head>
<body class="is-preload">
<div id="page-wrapper">
<!-- Header -->
<div id="header">
<!-- Logo -->
<h1><a href="index.html" id="logo">Welcome to NOMATH.TECH</a></h1>
</div>
<!-- Banner -->
<section id="banner">
<header>
<h2><em>Thank you for your message. We will be in touch.</em></h2>
<a href="/" class="button">Back to main page</a>
</header>
</section>
<!-- Highlights -->
<!-- Footer -->
<div id="footer">
<!-- Icons -->
<ul class="icons">
<li><a href="https://twitter.com/bcgandalf" class="icon brands fa-twitter"><span class="label">Twitter</span></a></li>
<li><a href="https://github.com/kf106" class="icon brands fa-github"><span class="label">GitHub</span></a></li>
<li><a href="https://www.linkedin.com/in/keirf/" class="icon brands fa-linkedin-in"><span class="label">LinkedIn</span></a></li>
</ul>
<!-- Copyright -->
<div class="copyright">
<ul class="menu">
<li>&copy; Thinklair Productions. All rights reserved</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
</ul>
</div>
</div>
</div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.dropotron.min.js"></script>
<script src="assets/js/browser.min.js"></script>
<script src="assets/js/breakpoints.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>

@ -0,0 +1,2 @@
#!/usr/bin/env bash
node server.js

@ -0,0 +1,31 @@
const express = require("express")
const fs = require('fs')
const bodyParser = require('body-parser')
const app = express()
const PORT = process.env.PORT || 8995
app.use(express.static("public"))
app.use(bodyParser.urlencoded({ extended: true }))
app.post('/subscribe', (req, res) => {
const name = req.body.name
const email = req.body.email
const msg = req.body.message.replace(/(?:\r|\n|\r\n)/g, '<br>')
const currentDate = new Date();
fs.appendFile('./database.txt', name + ";" + email + ";" + ";" + msg + ";" + currentDate + "\n", (err) => {
if (err) {
console.log(err);
}
else {
// Get the file contents after the append operation
console.log("\nFile Contents of file after append:\n",
fs.readFileSync("./database.txt", "utf8"));
}
})
res.redirect('/subscribed.html')
})
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
})
Loading…
Cancel
Save