Home > other >  Cannot GET / expo react
Cannot GET / expo react

Time:06-20

enter image description here I'm trying to connect to stripe server using express framework but I keep getting this error in the image I attached above.

import express from "express";

const app = express();
const port = 3000;
const PUBLISHABLE_KEY = "pk_test......";
const SECRET_KEY = "sk_test.........";


app.listen(port, () => {
    console.log(`Example app listening at http://localhost:${port}`);
});

CodePudding user response:

You have not did a GET method. Try to do - above the listening:

app.get('/',(req, res)=>{
    res.send('Hello World')
});

Now, when you call http://localhost:3000/ you will see Hello World.

  • Related