React JS

Node js React Mongodb Search Functionality

In this articles will teach how to search records Node js React Express Mongodb.how the search functionality works.
Node Js as backend front end React.

 

Create the Node js Project using following command

npm init

Install the following dependencies

  • npm i mongoose
  • npm i express
  • npm install –save-dev nodemon

Server.js

const express = require('express')
const sever = express()
const port = 4000
var routes = require('./routes/routes');
var mongoose = require('mongoose');
mongoose.set('strictQuery', true);
mongoose.connect("mongodb://127.0.0.1:27017/dbschool",{useNewUrlParser: true,  useUnifiedTopology: true },function checkDb(error)
{
    if(error)
    {
        console.log(error);
    }
    else
    {
        console.log("successfully Connected to DB");
    }
});

sever.use(express.json());
sever.use(routes);
sever.listen(port, () => {
  console.log(`Express port successfully ${port}`)
})

routes.js

var express = require('express');
var userController = require('../src/employee/userController');

const router = express.Router();

router.route('/user/findOne/:name').get(userController.findOneUserController);

module.exports = router;

userController.js

admin

Recent Posts

Laravel 11 CRUD Application

In this tutorial will teach Laravel 11 CRUD Application step by step. Laravel  11 CRUD…

3 weeks ago

How to make Times Table in React

in this tutorials we will be talk about how to make a times table in…

1 month ago

Laravel Tutorial: How to Add Numbers Easily Laravel 10

In this tutorials will teach How to add two numbers in Laravel 10. (more…)

1 month ago

Build Full-Stack Node.js MongoDB CRUD App with JWT Authentication

In this tutorial, we will teach the process of building a full-stack application using Node.js,…

2 months ago

Hospital Management System using OOP Java and MySQL

In this tutorial, we will explin you through the process of building a Hospital Management…

3 months ago

Mastering JavaScript OOP Inheritance

Inheritance in JavaScript using classes. You have a Person class as the superclass, an Employee…

3 months ago