I have a JS file in a folder called public, which also has my CSS file in it. I'm trying to access a function from the JS file (scripts.js), but am having no luck. I've followed this post (amongst others), but I am still getting an error of Error: Cannot find module './scripts.js'. If anyone can help me out, that would be great.
app.js
var express = require("express");
var app = express();
var bodyParser = require("body-parser");
var request = require("request");
var scripts = require("/scripts.js");
app.use(bodyParser.urlencoded({extended: true}));
app.set("view engine", "ejs");
app.use(express.static(__dirname + '/public'));
const apiUrl = "https://api.darksky.net/forecast/"; 
const apiKey = "XXX";
app.get('/', function(req, res){
    res.render("index");
});
app.post('/results', function(req, res){
    var lat = req.body.latitude;
    var long = req.body.longitude;
    request(apiUrl + apiKey + "/" + long + "," + lat, function(error, response, body){
        if (!error && response.statusCode == 200) {
            var data = JSON.parse(body);
            var temperature = scripts.converter(data.currently.temperature)
            res.render("results", {data: data, temperature: temperature})
        } else {
            console.log(response.body);
        }
    });
});
app.get('/results', function(req, res){
    res.render("results");
});
app.listen(3000, function(){
    console.log("Server has started");
})
scripts.js
module.converter = function(cel) {
        var cel = (far - 32) * (5/9);
        return cel;
}
exports.data = module;
 
    