diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/Public/aquarius.png b/Public/aquarius.png new file mode 100644 index 0000000..f59d930 Binary files /dev/null and b/Public/aquarius.png differ diff --git a/Public/aries.png b/Public/aries.png new file mode 100644 index 0000000..8282c3e Binary files /dev/null and b/Public/aries.png differ diff --git a/Public/cancer.png b/Public/cancer.png new file mode 100644 index 0000000..8866076 Binary files /dev/null and b/Public/cancer.png differ diff --git a/Public/capricorn.png b/Public/capricorn.png new file mode 100644 index 0000000..e8d7d76 Binary files /dev/null and b/Public/capricorn.png differ diff --git a/Public/gemini.png b/Public/gemini.png new file mode 100644 index 0000000..ceb9fc7 Binary files /dev/null and b/Public/gemini.png differ diff --git a/Public/leo.png b/Public/leo.png new file mode 100644 index 0000000..ccedf74 Binary files /dev/null and b/Public/leo.png differ diff --git a/Public/libra.png b/Public/libra.png new file mode 100644 index 0000000..9be9507 Binary files /dev/null and b/Public/libra.png differ diff --git a/Public/pisces.png b/Public/pisces.png new file mode 100644 index 0000000..0240a40 Binary files /dev/null and b/Public/pisces.png differ diff --git a/Public/sagittarius.png b/Public/sagittarius.png new file mode 100644 index 0000000..fd41bb1 Binary files /dev/null and b/Public/sagittarius.png differ diff --git a/Public/scorpio.png b/Public/scorpio.png new file mode 100644 index 0000000..3e9d988 Binary files /dev/null and b/Public/scorpio.png differ diff --git a/Public/taurus.png b/Public/taurus.png new file mode 100644 index 0000000..fb7781c Binary files /dev/null and b/Public/taurus.png differ diff --git a/Public/virgo.png b/Public/virgo.png new file mode 100644 index 0000000..9bc7cd2 Binary files /dev/null and b/Public/virgo.png differ diff --git a/zodiac.jpeg b/Public/zodiac.jpeg similarity index 100% rename from zodiac.jpeg rename to Public/zodiac.jpeg diff --git a/controllers/air.js b/controllers/air.js new file mode 100644 index 0000000..7f9f1bb --- /dev/null +++ b/controllers/air.js @@ -0,0 +1,23 @@ +const express = require("express") +const router = express.Router() + +const air = { + type: "air", + signs: ["Aquarius", "Gemini", "Libra"], + traits: ["movement", "creativity", "action", "adventure", "exciting", "easily provoked"] +} + +// main air route +// http GET url localhost:8000/air +router.get("/", (req, res) => { + res.render("show", {element: air}) +}) + +// air sign route +// http GET url localhost:8000/air/:sign +router.get("/:sign", (req, res) => { + // res.send(req.params.sign) + res.render("sign", {sign: req.params.sign}) +}) + +module.exports = router \ No newline at end of file diff --git a/controllers/earth.js b/controllers/earth.js new file mode 100644 index 0000000..9617cb3 --- /dev/null +++ b/controllers/earth.js @@ -0,0 +1,23 @@ +const express = require("express") +const router = express.Router() + +const earth = { + type: "earth", + signs: ["Taurus", "Virgo", "Capricorn"], + traits: ["grounded", "helpful", "practical", "realistic", "materialistic", "dependable"] +} + +// main air route +// http GET url localhost:8000/air +router.get("/", (req, res) => { + res.render("show", {element: earth}) +}) + +// air sign route +// http GET url localhost:8000/air/:sign +router.get("/:sign", (req, res) => { + // res.send(req.params.sign) + res.render("sign", {sign: req.params.sign}) +}) + +module.exports = router \ No newline at end of file diff --git a/controllers/fire.js b/controllers/fire.js new file mode 100644 index 0000000..1e64cfe --- /dev/null +++ b/controllers/fire.js @@ -0,0 +1,23 @@ +const express = require("express") +const router = express.Router() + +const fire = { + type: "fire", + signs: ["Aries", "Leo", "Sagittarius"], + traits: ["passionate", "strong emotions", "tempermental", "energetic", "accomplished", "interesting"] +} + +// main air route +// http GET url localhost:8000/air +router.get("/", (req, res) => { + res.render("show", {element: fire}) +}) + +// air sign route +// http GET url localhost:8000/air/:sign +router.get("/:sign", (req, res) => { + // res.send(req.params.sign) + res.render("sign", {sign: req.params.sign}) +}) + +module.exports = router \ No newline at end of file diff --git a/controllers/water.js b/controllers/water.js new file mode 100644 index 0000000..15636d9 --- /dev/null +++ b/controllers/water.js @@ -0,0 +1,23 @@ +const express = require("express") +const router = express.Router() + +const water = { + type: "water", + signs: ["Pisces", "Cancer", "Scorpio"], + traits: ["private", "mysterious", "pyshic", "charming", "emotional", "sensitive"] +} + +// main air route +// http GET url localhost:8000/air +router.get("/", (req, res) => { + res.render("show", {element: water}) +}) + +// air sign route +// http GET url localhost:8000/air/:sign +router.get("/:sign", (req, res) => { + // res.send(req.params.sign) + res.render("sign", {sign: req.params.sign}) +}) + +module.exports = router \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..3efd6f0 --- /dev/null +++ b/index.js @@ -0,0 +1,50 @@ +const express = require("express") +const app = express() + +const PORT = 8000 + +// graphic represented as an object +const elements = { + air: { + type: "air", + signs: ["Aquarius", "Gemini", "Libra"], + traits: ["movement", "creativity", "action", "adventure", "exciting", "easily provoked"] + }, + water: { + type: "water", + signs: ["Pisces", "Cancer", "Scorpio"], + traits: ["private", "mysterious", "pyshic", "charming", "emotional", "sensitive"] + }, + fire: { + type: "fire", + signs: ["Aries", "Leo", "Sagittarius"], + traits: ["passionate", "strong emotions", "tempermental", "energetic", "accomplished", "interesting"] + }, + earth: { + type: "earth", + signs: ["Taurus", "Virgo", "Capricorn"], + traits: ["grounded", "helpful", "practical", "realistic", "materialistic", "dependable"] + } +} + +// set the view engine +app.set("view engine", "ejs") +app.use(express.static("public")) + +// CONTROLLERS +app.use("/air", require("./controllers/air")) +app.use("/water", require("./controllers/water")) +app.use("/earth", require("./controllers/earth")) +app.use("/fire", require("./controllers/fire")) + +// ROUTES +// http GET url localhost:8000/ +// home route +app.get("/", (req, res) => { + res.render("index") +}) + + +app.listen(PORT, () => { + console.log(`smooth smooth sounds of javascript coming from port ${PORT}`) +}) \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..c12ac88 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "zodiac-controllers", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/views/index.ejs b/views/index.ejs new file mode 100644 index 0000000..324fbbd --- /dev/null +++ b/views/index.ejs @@ -0,0 +1,19 @@ + + +
+ + + +Let's learn about the signs!
+ + + \ No newline at end of file diff --git a/views/show.ejs b/views/show.ejs new file mode 100644 index 0000000..4784cb0 --- /dev/null +++ b/views/show.ejs @@ -0,0 +1,24 @@ + + + + + + +
+
+
\ No newline at end of file