Fri Sep 22 2023
Setup a NodeJS Project
Node JS45 views
File Name: index.js
const express = require("express");
const config = require("config");
const port = config.get("port");
const app = express();
app.use(express.json());
app.set("view engine", "ejs");
app.use(express.static("views"));
app.use((err, req, res, next) => {
console.error(err.stack);
res.status(500).jsonp("Internal Server Error!");
});
app.listen(process.env.PORT || port, async () => {
console.log(`Server Running at PORT: ${port}`);
});
File Name: package.json
{
"name": "auth-form",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Geekboots",
"license": "ISC",
"dependencies": {
"config": "^3.3.9",
"ejs": "^3.1.9",
"express": "^4.18.2"
}
}
Author:Geekboots