I cant run my code

Question:
I cant run my code and it gives me an error that I don’t understand

Current behavior:

Desired behavior

Repl link:

const express = require(express)
const app = express()

app.get(, (req, res) = {
  res.send(regerg)
})

app.listen(3000, () = {
  console.log(ETOIMOS)
})
let Discord = require(discord.js);
let client = new Discord.Client();
client.on(message, message = {
if (message.content === egegererg) {
message.channel.send(wrfgwrg)
}
if(message.content === !k) {
 let embed = new Discord.MessageEmbed()
 .setTitle(geia !)
 .setDescription(ergerge)
 .setColor(reggergerasagfweg)
 .setFooter(βfgergerfrerev)
 message.channel.send(embed)
}
})

client.login(MTE0NTY2MjA2MTY2MjE5NTc0Mg.GdJ5x2.Y3JfCDNzW3ZY3mc-C7SoXFJ5X3dkumkWOXRg8Y)

Hi @kokobim, and welcome to Ask!

Could you please send the error so we can help you more?

1 Like

Yes, of course one minute

/home/runner/PiratesCraft/index.js:4
app.get(, (req, res) = {
        ^

SyntaxError: Unexpected token ','
Hint: hit control+c anytime to enter REPL.

This is an error !!!

You have to specify the app route for that to work. EX:

app.route("/", (req, res) => {
//Code here
});
1 Like

I’m sorry but I don’t know well, can you tell me what I should write in the code and where I should write it??

Just add "/" to your current code here

2 Likes

I wrote this "/" instead of that, but it also gives me the error:

/home/runner/PiratesCraft/index.js:5
  res.send(regerg)
     ^

SyntaxError: Unexpected token '.'

The error there is actually on the previous line, change the = to =>.

1 Like
/home/runner/PiratesCraft/index.js:4
app.get("/" (req, res) => {
            ^^^^^^^^^

SyntaxError: Malformed arrow function parameter list

Add the comma back app.get("/", (req, res) => {

2 Likes

so ? ,app.get("/" (req, res) => {

Incorrect syntax

Correct syntax

3 Likes

I did and now it says this :

/home/runner/PiratesCraft/index.js:8
app.listen(3000, () = {
                  ^

SyntaxError: Unexpected token ')'

You’re missing another arrow. app.listen(3000, () => {

2 Likes

now ?

/home/runner/PiratesCraft/index.js:14
if (message.content === egegererg) {
           ^

SyntaxError: Unexpected token '.'

Change to client.on(message => {

Also how are you not getting errors for all the characters you spammed? :thinking:

3 Likes

I can not take it anymore

/home/runner/PiratesCraft/index.js:19
 .setTitle(geia !)
           ^^^^

SyntaxError: missing ) after argument list

Maybe you shouldn’t be a programmer then. Idk if that sounds rude but in programming you’re going to get a LOT of errors

Just remove the !

3 Likes