I converted my html website into node js, but my js files are not working correctly. They are running, but there are some errors in them

Viewed 43

MY Node js is working correctly (phenomit.com This is my design website its in HTML)

My errors are:

Uncaught TypeError: Cannot read properties of undefined (reading 'each')at waypoints.min.js:7:9157

at waypoints.min.js:7:9567jquery.counterup.min.js:8 Uncaught ReferenceError: jQuery is not defined

at jquery.counterup.min.js:8:910jquery.magnific-popup.min.js:4 Uncaught TypeError: a is not a function

at jquery.magnific-popup.min.js:4:374 at jquery.magnific-popup.min.js:4:73

at jquery.magnific-popup.min.js:4:147custom.js:4 Uncaught ReferenceError: jQuery is not defined at custom.js:4:24

I have shared the code in my git

enter image description here

https://github.com/GoD-ATHEN/Phentom

const express = require('express');
    const app = express();
    const mysql = require('mysql');
    const router = express.Router();
    const path = require('path');
    const ifl = path.join(__dirname, '/views/assets/')
    
    app.set('view engine', 'ejs');
    app.use('/assets',express.static(ifl));
    
    //CONNECTION CONFIGURATION
    var con = mysql.createConnection({
        host: "localhost",
        user: "root",
        password: "",
        database: "phentom"
       });
    
    app.get("/contact", (req, res)=>{
        res.render("contact");
    });
    
    app.get('/askquestion', (req, res) =>{
        con.query(`INSERT INTO contactq (name, email, subject, massage) VALUES ('${req.query.name}', '${req.query.email}', '${req.query.subject}', '${req.query.message}')`, function (err, result, fields) {
          if (err) throw err;
          res.redirect('https://phenomit.com/');
        });
    });
    
    app.listen(3000);
2 Answers

Okay, so I don't know what happened. I just added a JQuery CDN link in my footer, and now it's all working.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

This is the link

For me it works. I downloaded from github, ran npm install and then:

  • Did you run node index.js ?
  • Did you visit http://localhost:3000/contact ?
  • jQuery - please uncomment this line <script src="assets/js/jquery-3.6.0.min.js"></script>

That's it. it works.

Related