├── .gitignore ├── public ├── main.js ├── styles.css └── index.html ├── package.json └── server.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .env -------------------------------------------------------------------------------- /public/main.js: -------------------------------------------------------------------------------- 1 | function run() { 2 | fetch("/api/movie") 3 | .then((response) => response.json()) 4 | .then((data) => { 5 | const detailsElement = document.getElementById("movie"); 6 | 7 | detailsElement.getElementsByTagName("img")[0].src = data.poster; 8 | detailsElement.getElementsByTagName("h1")[0].innerText = data.title; 9 | detailsElement.getElementsByTagName("p")[0].innerText = data.fullplot; 10 | 11 | detailsElement.style.visibility = "visible"; 12 | }); 13 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "leaflix", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node server.js", 8 | "start:dev": "nodemon -r dotenv/config server.js", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "dotenv": "^8.2.0", 16 | "express": "^4.17.1", 17 | "mongodb": "^3.6.0" 18 | }, 19 | "devDependencies": { 20 | "nodemon": "^2.0.4" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /public/styles.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | font-family: 'Barlow' ; 3 | } 4 | 5 | body { 6 | font-family: 'Barlow' ; 7 | width: 50%; 8 | margin-left: 25%; 9 | text-align: justify; 10 | line-height: 1.7; 11 | font-size: 18px; 12 | } 13 | 14 | button { 15 | font-size: 18px; 16 | font-weight: 600; 17 | color: #000; 18 | font-family: 'Barlow' ; 19 | } 20 | 21 | #laugh { 22 | background-color: #fedc65; 23 | } 24 | 25 | #movie { 26 | display: flex; 27 | flex-direction: row; 28 | margin-top: 45px; 29 | } 30 | 31 | #movie img { 32 | margin-right: 45px; 33 | width: 400px; 34 | height: 600px; 35 | object-fit: cover; 36 | } 37 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |What will you watch today?
12 | 13 |