Skip to content

Commit 431d96c

Browse files
committed
Create initial folder structure
1 parent 9458c6b commit 431d96c

File tree

7 files changed

+78
-0
lines changed

7 files changed

+78
-0
lines changed

.env.sample

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PORT="Your PORT value"

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
package-lock.json
3+
.env

app.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require("dotenv").config();
2+
const express = require("express");
3+
const routes = require("./routes");
4+
5+
const PORT = process.env.PORT;
6+
const app = express();
7+
8+
app.use(express.static(__dirname + "/public"));
9+
app.use("/", routes);
10+
11+
app.set("views", "./views");
12+
app.set("view engine", "ejs");
13+
14+
app.listen(PORT, () => {
15+
console.log(`Server started at port ${PORT}`);
16+
});

package.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "Blog-App",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "app.js",
6+
"scripts": {
7+
"start": "node app.js",
8+
"startDev": "nodemon app.js"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/tanmayc07/Blog-App.git"
13+
},
14+
"keywords": [],
15+
"author": "Tanmay",
16+
"license": "ISC",
17+
"bugs": {
18+
"url": "https://github.com/tanmayc07/Blog-App/issues"
19+
},
20+
"homepage": "https://github.com/tanmayc07/Blog-App#readme",
21+
"dependencies": {
22+
"dotenv": "^8.2.0",
23+
"ejs": "^3.1.3",
24+
"express": "^4.17.1"
25+
},
26+
"devDependencies": {
27+
"nodemon": "^2.0.4"
28+
}
29+
}

public/css/styles.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
h1 {
2+
color: red;
3+
}

routes/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const routes = require("express").Router();
2+
3+
routes.get("/", (req, res) => {
4+
res.render("home", { title: "Tanmay" });
5+
});
6+
7+
module.exports = routes;

views/home.ejs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="/css/styles.css" type="text/css">
8+
<title>Homepage</title>
9+
</head>
10+
11+
<body>
12+
<h1>
13+
Hello World
14+
</h1>
15+
<br><br>
16+
<h2><%= title %></h2>
17+
</body>
18+
19+
</html>

0 commit comments

Comments
 (0)