aboutsummaryrefslogtreecommitdiff
path: root/src/server.js
diff options
context:
space:
mode:
authorMark Powers <markppowers0@gmail.com>2018-12-09 12:43:06 -0500
committerMark Powers <markppowers0@gmail.com>2018-12-09 12:43:06 -0500
commit3d1b09c628b58f8bc9f9c76682d3d78885ae6376 (patch)
treea064a57b10202bfad25d46622deed86de115cec2 /src/server.js
parentd00a1a362b04699b246be4ca2ca471fbce60368b (diff)
Initial commit
Diffstat (limited to 'src/server.js')
-rw-r--r--src/server.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/server.js b/src/server.js
new file mode 100644
index 0000000..e2cfb20
--- /dev/null
+++ b/src/server.js
@@ -0,0 +1,33 @@
+const express = require('express');
+
+const port = 80;
+
+const server = express();
+
+function listen(){
+ server.listen(port, () => console.info(`Listening on port ${port}!`));
+}
+
+function setUpRoutes(){
+ server.get('/', (req, res) => res.sendFile(__dirname + "/html/index.html"))
+ server.get('/bread', (req, res) => res.sendFile(__dirname + "/html/bread.html"));
+ server.get('/essay', (req, res) => res.sendFile(__dirname + "/html/essay.html"));
+
+
+ server.get('/css/:id', (req, res) => {
+ res.sendFile(__dirname + "/css/"+req.params.id);
+ });
+ server.get('/photo/:id', (req, res) => {
+ res.sendFile(__dirname + "/photo/"+req.params.id);
+ });
+ server.get('/essay/:id', (req, res) => {
+ res.sendFile(__dirname + "/html/essay/"+req.params.id);
+ });
+
+}
+
+module.exports = {
+ listen,
+ setUpRoutes
+};
+