Coder Social home page Coder Social logo

nodeexpresscrudrestapi's Introduction

CRUD Backend Server

This repository contains the backend code for a RESTful API basic crud options using Express.js and MongoDB. This API allows you to perform CRUD operations (Create, Read, Update, Delete) providing a simple way to interact with content.

Technology Used- ExpressJs, MongoDB, RestAPI

Features

- Create new todo items with titles, description, and other details.
- Retrieve a list of all todoitems or specific todo details.
- Update todo item information.
- Delete todo item from the database.

Prerequisites

  • Node.js and npm should be installed on your machine
  • MongoDB should be installed and running
  • Mongoose should be installed and running
  • Express.js should be installed and running
  • Nodemon should be installed and runnig

Installation

  1. Clone the repository:

    https://github.com/robertostepic/NodeExpressCrudRestAPI.git
  2. Navigate to the project directory:

    cd CRUDNOAUTH
  3. Install dependencies:

    npm install express dotenv mongoose nodemon

Configuration

  1. Create a .env file and set the following environment variables:

    PORT=5000
    MONGODB_URI=your_mongodb_connection_uri
    

Usage

  1. Start the server:

    npm run server
    nodemon index.js
  2. The API will be accessible at http://localhost:5000.

API Endpoints

- `GET /api/all-todos`: Get a list of all posts.
- `GET /api/todo/:id`: Get details of a specific post by ID.
- `POST /api/new-todo`: Create a new  post.
- `PUT /api/update-todo/:id`: Update details of a specific  post by ID.
- `DELETE /api/delete-todo/:id`: Delete a  post by ID.

๐Ÿ“ Directory view

.
โ”œโ”€โ”€ controllers                    # Main controller folder
โ”‚       โ”‚
โ”‚       โ”œโ”€โ”€ todoController.js      # function controller - brain of routes
โ”‚
โ”œโ”€โ”€ db                             # Main database folder
โ”‚    โ”‚
โ”‚    โ”œโ”€โ”€ connect.js                # Database connection 
โ”‚
โ”œโ”€โ”€ models                         # User - Database Schema
โ”‚      โ”‚
โ”‚      โ”œโ”€โ”€ todoRoutes              # MongoDb database schema for todo
โ”‚
โ”œโ”€โ”€ routes                         # Context - Global State Manager
โ”‚      โ”‚
โ”‚      โ”œโ”€โ”€ todoRoutes              # Todo routes - create, read, update, delete
โ”‚
โ”œโ”€โ”€ .env.                          # Hidden config files for mongodb, port
โ”‚
โ”‚
โ””โ”€โ”€ index.js                       # Startpoint of the Entire Application

Contributing

Contributions are welcome! If you find any issues or want to enhance the project, feel free to create a pull request.

  1. Fork the repository.
  2. Create a new branch for your feature: git checkout -b feature-name.
  3. Commit your changes: git commit -am 'Add feature'.
  4. Push to the branch: git push origin feature-name.
  5. Submit a pull request.

Snapshots

home page

Authors

๐Ÿš€ About Me

I'm an amateur developer from Croatia.

Support

For support, email [email protected]

nodeexpresscrudrestapi's People

Contributors

robertostepic 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.