Skip to content
Open

Solved #2769

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
15 changes: 15 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const express = require('express');
const app = express();

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

app.get('/', (request, response, next) => response.sendFile(__dirname + '/views/home.html'));

app.get('/about', (request, response, next) => response.json({
name: "Toni",
age: 27,
height: "1.78"
}));
app.get('/work', (request, response, next) => response.sendFile(__dirname + '/views/work.html'));

app.listen(3000, () => console.log('My first app listening on port 3000!'));
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"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",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.19.2"
}
}
4 changes: 4 additions & 0 deletions public/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body{
background-color: red;

}
12 changes: 12 additions & 0 deletions views/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Welcome visitor</h1>

</body>
</html>
12 changes: 12 additions & 0 deletions views/work.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="public\style.css">
</head>
<body>
<h1>This is my html linked to css</h1>
</body>
</html>