in

Type Error require(…) load is not a function?


My server was working fine until added the top part. I can no longer get my server to run. I do not know much about javascript nor servers 🙁

if (process.env.NODE_ENV !== 'production') {
require('dotenv').load()
}

const stripeSecretKey = process.env.STRIPE_SECRET_KEY
const stripePublicKey = process.env.STRIPE_PUBLIC_KEY

console.log(stripeSecretKey)

const express = require('express')
const app = express()
const fs = require('fs')

app.set('view engine', 'ejs')
app.use(express.static('public'))

app.get('/store', function(req, res) {
    fs.readFile('items.json', function(error) {
    if (error) {
        res.status(500).end()
    } else {
        res.render('store.ejs', {
           items: JSON.parse(data) 
        })
    }
 })

 })

 app.listen(3000) 

I have been following this tutorial: https://www.youtube.com/watch?v=mI_-1tbIXQI&list=LL&index=5&t=284s

I do not think I made any mistakes but for some reason I am getting this error.



Source: https://stackoverflow.com/questions/70604383/type-error-require-load-is-not-a-function

ArticleStaff 2.0 — A workflow system for managing your freelance writers

Airtel Payments Bank, Park+ to Offer FASTag Based Smart Parking Solutions