text: const express=require("express"),compression=require("compression"),path=require("path"),cors=require("cors"),bannersData=require("./server/banners/index.get.json"),categoriesData=require("./server/categories/index.get.json"),productsData=require("./server/products/index.get.json"),addToCartAPIResponseData=require("./server/addToCart/index.post.json");let users=require("./users/users.js");const port=3e3,app=express();app.use(cors()),app.use(compression()),app.use(express.static(path.join(__dirname,"/"))),app.use(express.json()),app.get("/",(function(e,s){s.sendFile("index.html",{root:__dirname})})),app.get("/banners",((e,s)=>{s.json(bannersData)})),app.get("/categories",((e,s)=>{s.json(categoriesData)})),app.get("/products",((e,s)=>{s.json(productsData)})),app.post("/addToCart",((e,s)=>{s.json(addToCartAPIResponseData)})),app.post("/register",((e,s)=>{users.find((s=>s.email===e.body.email))?s.json({status:"failure",message:"User already exist with same email"}):(users=[...users,{...e.body,id:(new Date).getTime()}],s.json({status:"success",message:"User registered successfully"}))})),app.get("*",((e,s)=>{s.sendFile("pageNotFound.html",{root:__dirname})})),app.listen(3e3);