I wanted to make a blog in pure react js and Nodejs(express,mongodb) . Also i can post code snippets and heading rather than a simple text
An example of a blogpost Example of Blog post
An example of a blogpost Example of Blog post
I am Using React Router Dom V6 Here if(!localStorage.getItem("token")){ navigate("/login") } is not Working import React,{useState,useEffect} from 'react'; import axios from 'axios'; import { useNavigate } from 'react-router-dom'; const Home = (props) => { const [user,setUser]=useState(null); let navigate = useNavigate();…
I have the following long schema: const mySchema = new mongoose.Schema({ // some stuff, firstName, lastName ... etc password: { type: String, minLength: 8, maxLength: 120, } }) And I am inside one of the routes, I want to run…
I've been working with react using mern stack. Everything was fine until I used JSON.parse in a function when getting data out of the mongo database. I clicked save and I got 9 errors. I removed all the code, everything…
User is lazy, don't want to wait for data and quit the page. How I can access router.post to stop further code execution? APP.JS FILE (backend): var express = require('express'); var expressSession = require('express-session'); var redis = require('redis'); var connectRedis…
I'm new to whole authentication/authorization part in web development. Specifically JWT. So I came across a medium post explaining the fundamentals of JWT. There was a diagram which showed how the web server and authentication server had no direct communication,…
When I click to delete a post, my console is saying TypeError: post.user.posts.deleteOne is not a function. It giving me this error after deleting. const post = await Post.findByIdAndDelete(id).populate('user'); This code I am deleting the post from Post Schema await…
I have a frontend and express js server hosted on aws lightsail that uses ubuntu with nginx. The server is set as a reversed proxy. Here is the config location /api/ { proxy_pass http://localhost:4000/api/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header…
I've building an api backend for a mobile app built with react-native. And mobile developer has provided a json data file by mobile developer with the following data format. { "firstName": "John", "imageURL": "https:link-to-image.com/file.jpg", "lastName": "Joe", "linkURL": null, "middleName": null,…
I had an issue with the axios.get() when I tried to call my API from the frontend, it returned but when I test my backend with postman it is okay. Cannot GET http://localhost:3040/v2/user/[object%20Object] Please check code below: backend api router.get(…