About Me
+About Me Page
+ + + + +diff --git a/axiosdemo.js b/axiosdemo.js new file mode 100644 index 00000000..0a243276 --- /dev/null +++ b/axiosdemo.js @@ -0,0 +1,12 @@ + +const axios = require("axios").default; + +const url = "http://localhost:3000/"; + +const resultingPromise = axios.get(url); + +resultingPromise.then(printLogResultsOfGet); + +function printLogResultsOfGet(result) { + console.log(result.data); +} \ No newline at end of file diff --git a/dbdemoapp.js b/dbdemoapp.js new file mode 100644 index 00000000..edbc1bf0 --- /dev/null +++ b/dbdemoapp.js @@ -0,0 +1,29 @@ +const express = require('express'); + +const { makeDBConnectionPool } = require("./dbhelp"); + +const pool = makeDBConnectionPool("omdb"); + +const app = express(); + +let movieList = [] + +app.listen(3000) + +app.get('/',(request, response) =>{ + response.json(movieList); +}); + +function displayMovies(movieRows) { + for (let row of movieRows) { + movieList.push(row.movie_name); + } + return movieList; +} +function arrayofMovies(){ + pool.query("select movie_name from casts_view where person_name = 'Tom Hardy'").then((results) => { + displayMovies(results.rows); + }); +} + +arrayofMovies(); \ No newline at end of file diff --git a/dbhelp.js b/dbhelp.js new file mode 100644 index 00000000..9b3c6e36 --- /dev/null +++ b/dbhelp.js @@ -0,0 +1,14 @@ +const { Pool } = require("pg"); + +/** + *Makes a pool of connections to the named database. it is assumed the db is on localhost. + * @param {string} dbName name of database to connect to + */ +function makeDBConnectionPool(dbName) { + //Understanding the details is not important here. + return new Pool({ + database: dbName, + }); +} + +module.exports = { makeDBConnectionPool }; \ No newline at end of file diff --git a/dieroll.js b/dieroll.js new file mode 100644 index 00000000..11a7f41a --- /dev/null +++ b/dieroll.js @@ -0,0 +1,25 @@ +const express = require('express'); + +const app = express(); + +app.listen(3000) + +app.get('/roll1',(request, response) =>{ + response.send('Your dice roll is:' + randomDieRoll1()) +}); + +app.get('/roll2',(request, response) =>{ + response.send('Your dice roll is:' + totalDiceRoll()) +}); + +function randomDieRoll1(){ + return 1 + Math.floor((Math.random() * 6)) +} + +function randomDieRoll2(){ + return 1 + Math.floor((Math.random() * 6)) +} + +function totalDiceRoll(){ + return randomDieRoll1() + randomDieRoll2() +} \ No newline at end of file diff --git a/html/about.html b/html/about.html new file mode 100644 index 00000000..450105c1 --- /dev/null +++ b/html/about.html @@ -0,0 +1,16 @@ + + +
+About Me Page
+ + + + +The worlds Greatest Director?
+
+ I find it very hard to chose favouorite films but in the interests of making this website I will give my top 3 Christopher Nolan films in order.
+Find out more about Christpoher Nolan from this link
+ + +