Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const express = require("express");

const app = express();

app.use(express.static('public'));
app.use(express)

app.get("/home", (req, res) => {
res.send("This is Rocky")

/* res.json({
name: "Rocky",
request: "home",
})*/

});


app.get("/about", (req, res) => {
res.send("About Rocky")

});

app.get("/work", (req, res) => {
res.send("Gallery of Rocky")

});
app.listen(3000, () => {
console.log('Listening server...')
});


app.get('/', (request, response,) => {
response.send(`
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Cat</title>
<link rel="stylesheet" href="/style.css" />
</head>
<body>
<h1>ROCKY BALBOA HTML</h1>
<p>This is my second route OF ROCKY</p>
<img src="public/rocky.jpg" />
</body>
</html>
`);
});

app.get('/home', (request, response, next) => response.sendFile(__dirname + '/views/index.html'));
77 changes: 77 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"name": "lab-express-basic-site",
"version": "1.0.0",
"description": "![logo_ironhack_blue 7](https://user-images.githubusercontent.com/23629340/40541063-a07a0a8a-601a-11e8-91b5-2f13e4e6b441.png)",
"main": "app.js",
"dependencies": {
"accepts": "^1.3.8",
"array-flatten": "^1.1.1",
"body-parser": "^1.20.2",
"bytes": "^3.1.2",
"call-bind": "^1.0.7",
"content-disposition": "^0.5.4",
"content-type": "^1.0.5",
"cookie": "^0.6.0",
"cookie-signature": "^1.0.6",
"debug": "^2.6.9",
"define-data-property": "^1.1.4",
"depd": "^2.0.0",
"destroy": "^1.2.0",
"ee-first": "^1.1.1",
"encodeurl": "^1.0.2",
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
"escape-html": "^1.0.3",
"etag": "^1.8.1",
"express": "^4.19.2",
"finalhandler": "^1.2.0",
"forwarded": "^0.2.0",
"fresh": "^0.5.2",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.4",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.2",
"has-proto": "^1.0.3",
"has-symbols": "^1.0.3",
"hasown": "^2.0.2",
"http-errors": "^2.0.0",
"iconv-lite": "^0.4.24",
"inherits": "^2.0.4",
"ipaddr.js": "^1.9.1",
"media-typer": "^0.3.0",
"merge-descriptors": "^1.0.1",
"methods": "^1.1.2",
"mime": "^1.6.0",
"mime-db": "^1.52.0",
"mime-types": "^2.1.35",
"ms": "^2.0.0",
"negotiator": "^0.6.3",
"object-inspect": "^1.13.1",
"on-finished": "^2.4.1",
"parseurl": "^1.3.3",
"path-to-regexp": "^0.1.7",
"proxy-addr": "^2.0.7",
"qs": "^6.11.0",
"range-parser": "^1.2.1",
"raw-body": "^2.5.2",
"safe-buffer": "^5.2.1",
"safer-buffer": "^2.1.2",
"send": "^0.18.0",
"serve-static": "^1.15.0",
"set-function-length": "^1.2.2",
"setprototypeof": "^1.2.0",
"side-channel": "^1.0.6",
"statuses": "^2.0.1",
"toidentifier": "^1.0.1",
"type-is": "^1.6.18",
"unpipe": "^1.0.0",
"utils-merge": "^1.0.1",
"vary": "^1.1.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Binary file added public/rocky.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
body {
color: blue;
background-color: rgb(5, 5, 5);
}

17 changes: 17 additions & 0 deletions views/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Rocky Balboa</title>
<link rel="stylesheet" href="/public/style.css" />
</head>
<body>

<h1>Rocky Balboa</h1>

<p>This is my second route</p>
<img src="/public/rocky.jpg" />
</body>
</html>