Giter Club home page Giter Club logo

express-rest-api-exercise's Introduction

Express-Rest-API-Exercise

This repository contains a simple REST API built using Express, Node.js, and MongoDB. It was developed as an exercise for a course at the SENA.

Caution

The code from this project is not production ready due to the lack of error handling and improper configuration of resources, among other aspects.

Key Features

  • Provides endpoints for managing posts (CRUD operations).
  • Connects to a MongoDB database securely using environment variables.
  • Uses Mongoose for interacting with MongoDB data.

Getting Started

  1. Clone this repository:
git clone https://github.com/jmferreirab/Express-Rest-API-Exercise.git
  1. Install dependencies:
npm install
  1. Create a .env file in the root directory and add the following variables:
DB_USER=your_mongodb_user
DB_PASSWORD=your_mongodb_password
DB_NAME=your_mongodb_database_name
DB_HOST=your_mongodb_host
  1. Start the server:
npm start

Available Endpoints

  • GET /servicios/posts: Get a list of all posts.
  • POST /servicios/posts: Create a new post.
  • GET /servicios/posts/:id: Get a specific post by ID.
  • PUT /servicios/posts/:id: Update an existing post.
  • DELETE /servicios/posts/:id: Delete a post.

Additional Information

  • The app.js file contains the main application logic.
  • The routes/post.js file defines the routes and logic for the post endpoints.
  • The models directory contains Mongoose models for the data schema.

Contact

For any questions or issues, feel free to create a new issue.

express-rest-api-exercise's People

Contributors

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