简体   繁体   中英

JWT token Error preventing backend api connection Node/Express MongoDB

I am creating a blogging application using Node, Express and Next.js. I have successfully deployed the frontend portion of the application however I am running into an error when trying to connect to the backend server:

Error: secret should be set

在此处输入图像描述

Here is a link to my Github with all the code https://github.com/DragonKnightLeo/Blog-API

This is my first fullstack application so I am pretty junior at how all this works.

I just went through the code and tried to see if I can run your code in my local. Also, saw the error that is coming when you run the code in your logs above. Seems like you do not have a.env file or JWT_SECRET mentioned in your env file.

在此处输入图像描述

Try adding env file and use dotenv node module to bootstrap it along the server run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM