Hello Universe

Simple index view with ejs
This commit is contained in:
Sunny Dhoke
2020-10-08 10:33:57 +05:30
parent a1a25c8ac9
commit a0a339aa3f
4 changed files with 19 additions and 1 deletions

View File

@@ -19,4 +19,5 @@ ejs- templating language to create views
### dev dependencies
`npm i --save-dev nodemon`
//npm install -g nodemon
For refreshing server for every new change

1
Views/index.ejs Normal file
View File

@@ -0,0 +1 @@
Hello Universe

View File

@@ -4,7 +4,7 @@
"description": "A url shortner",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"devStart": "nodemon server.js"
},
"repository": {
"type": "git",

16
server.js Normal file
View File

@@ -0,0 +1,16 @@
const express = require("express");
//make basic app
const app = express();
//setting ejs as view engine
app.set("view engine", "ejs");
// index page with request and response parameters
app.get("/", (req, res) => {
res.render("index");
});
// start listening on specified port
app.listen(process.env.PORT || 4567);