You need to set valid KEY for express-jwt
. Create a .env
file & add the follwoing as per README:
The README file says:
-Create a `.env` file in the `backend` directory and add the following fields in it:
```
PORT = 4000
SECRET_KEY = ApacheAgeViewer
MONGO_URI = mongodb+srv://safi50:cloudExpress@cloud-express.le2yrog.mongodb.net/cloud-express-users?retryWrites=true&w=majority
```
- Secret Key is used to encrypt JWT Token
- MONGO_URI contains the string to connect to our online Database cluster. It will be replaced with an official production string once development is complete.
This key is being used in index.js
in backend folder at line:53
. Also, make sure that it is referring to correct value (Im sure it is).
app.use(
expressjwt({
secret: process.env.SECRET_KEY,
algorithms: ['HS256'],
getToken: (req) => req.cookies.token,
}).unless({ path: ['/user/login', '/user/signup', '/user/googleSignin'] })
);
After this follow the same steps to execute the code & you are good to go.
npm run start
and
cd backend
node index