ecommerce-website/routes/index.js

30 lines
1.0 KiB
JavaScript
Raw Normal View History

2024-03-10 20:04:53 +00:00
const express = require('express');
const router = express.Router();
const { getUser } = require('../util.js');
// Rendering the main page
router.get('/', function (req, res) {
console.log(getUser(req));
res.render('layouts/main', {
title: "Nat & Sami's Rare Earth Metals",
loggedIn: getUser(req) != null,
user: getUser(req),
content: `
<form action='/listprod' class="product-search-container">
<div class="product-search">
<h1 align="center">Nat &amp; Samira's Rare Earth Metals</h1>
<input type='text' name='productName' id='productNameInput' placeholder="Find what you're looking for..."/><br>
<input type='submit' value='Search'/>
<button type='button' onclick='document.getElementById("productNameInput").value = "";'>
Reset
</button>
</div>
</form>
`,
});
})
module.exports = router;