Git Product home page Git Product logo

mern-crud's Introduction

MERN crud

A simple crud application used to demonstarate crud operations in a MERN app.
View Demo

Note:

  • The frontend part of the project uses Vitejs as the front end build tool.
  • The frontend part of the project was bootstrapped using the command npm init vite

Table of Contents

Features

  • List of all users can be fetched.
  • New user can be added
  • A user's details can be edited
  • A user can be deleted.

Tools and Technologies

  • HTML
  • CSS
  • Material UI
  • Javascript
  • Node.js
  • Express.js
  • React
  • Mongodb
  • Vitejs

Dependencies

  • @material-ui/core
  • axios
  • react
  • react-dom
  • react-router-dom
  • cors
  • dotenv
  • express
  • mongoose

Dev-dependencies

  • @vitejs/plugin-react
  • vite
  • nodemon
  • concurrently

Prerequisites

  • Node.js must be installed on the system.
  • You should have a MongoDB database.
  • You should have a code editor (preferred: VS Code)

Installation and Setup

  1. Download the source code in the desired location on your system.

  2. Open the code in your code editor.

  3. Go to terminal and type the following command and hit enter:

    npm run install-all

    This will install all the dependencies and dev-dependencies required at root, at frontend and at backend in your project.

  4. Create a file named ".env" inside the backend folder and enter the following credentials:

    MONGO_URI=your-mongo-uri
  5. Go to terminal and type the following command and hit enter:

    npm run dev

    This will start both backend and frontend.

  6. Open browser and go to url: http://localhost:3000. You can see the app running now.

Backend API

- GET     /api/users      [fetch all the users from the db]
- GET     /api/user/:id   [fetch a user by id from the db]
- POST    /api/users      [add a user into the db]
- PUT     /api/users/:id  [update a user by id in the db]
- DELETE  /api/users/:id  [delete a user by id from the db]

npm scripts

At root:

  • npm run dev: Starts both backend and frontend
  • npm run dev-server: Starts only backend
  • npm run dev-client: Starts only frontend
  • npm run install-all: Installs all dependencies and dev-dependencies required at root, at frontend and at backend.

Inside frontend folder:

  • npm run dev: Starts frontend
  • npm run build: build frontend for production
  • npm run preview: locally preview production build

Inside backend folder:

  • npm run dev: Starts backend using nodemon.
  • npm start: Starts backend without nodemon.

Useful Links

Contact

mern-crud's People

Contributors

aayush301 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.