Ask coding questions

← Back to all posts
Why is my website showing up with the replit robot saying 'run the repl' on my landing page
h
716green (3)

This is what I see when I go to my website (after paying for a year of hosting and setting up the CNAME records with Google Domains):

I can't find any relevant documentation. WHat needs to be done? My NodeJS server is setup to run as follows:

[.replit]
language = "nodejs"
run = "node server.js"

Shouldn't it be directing to the actual image of my site?

Comments
hotnewtop
[deleted]

Eh, sometimes it does this - It's a repl.it error and you can't fix it client side, just log out of repl.it, clear your cookies then open repl.it again, I think that should work.

AdCharity (1322)

@JacksonCowie Well I mean, the repl is private (so it's not like we can actually tell)

[deleted]

@AdCharity Yeah but errors like that have happened to me and theirs been nothing wrong with my code. That's why I'm basing it on repl.it

AdCharity (1322)

@JacksonCowie ye I'm mainly directing the "repl is private" thing to the "asker" / OP / @716green

716green (3)

@JacksonCowie I wonder if I'm listening on the wrong port:

process.env.NODE_ENV = 'production'

if (process.env.NODE_ENV !== 'production') {
    require('dotenv').config({path:'.env'});
}

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

console.log('stripeSecretKey removed. Public key:', stripePublicKey)

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

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

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


app.post('/purchase', function(req, res) {
    fs.readFile('items.json', function(error, data) {
        if (error) {
            res.status(500).end()
        } else {
            const itemsJson = JSON.parse(data)
            const itemsArray = itemsJson.startup.concat(itemsJson.resources).concat(itemsJson.consulting)
            // my 3 sections: startup, resources, consulting
            // example with 2 sections: const itemsArray = itemsJson.music.concat(itemsJson.merch)
            let total = 0
            req.body.items.forEach(function(item) {
                const itemJson = itemsArray.find(function(i) {
                return i.id == item.id
                })
                total = total + itemJson.price * item.quantity
            })

            stripe.charges.create({
                amount: total,
                source: req.body.stripeTokenId,
                currency: 'usd'
            }).then(function() {
                console.log('Charge Successful')
                res.json({ message: 'Successfully purchased items' })
            }).catch(function() {
                console.log('Error Failed')
                res.status(500).end()
            })
        }
    })
})

app.listen(3000)
[deleted]

@716green Port 3000 should work - Try 8000 or 8080.

716green (3)

@JacksonCowie Thank you. It just took a really long time for Google to route the domain correctly apparently I just had to disconnect and reconnect after some time passed. I was on port 3000.