Git Product home page Git Product logo

vercel-mongodb-rest-api's Introduction

Vercel MongoDB REST API

This project is a REST API implemented using Vercel as a Function as a Service (FaaS) platform and MongoDB for data storage.

Features

  • Serverless deployment with Vercel
  • MongoDB database
  • REST API with CRUD (Create, Read, Update, Delete) operations

Requirements

  • Node.js
  • Vercel CLI
  • MongoDB Atlas account or access to a MongoDB instance

Installation

  1. Clone the repository:
  gh repo clone torrresagus/Vercel-Mongodb-Rest-API
  1. Navigate to the project folder and install dependencies:
cd Vercel-Mongodb-Rest-API
npm install
  1. Set up environment variables in a .env file in the project root (replace your_mongo_user and your_mongo_password with your MongoDB user and password):
MONGO_USER="your_mongo_user"
MONGO_PASSWORD="your_mongo_password"

In index.js, make sure you are using the MongoDB URI with the correct cluster name, database name, and environment variables for the user and password:

const mongoUri = `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@your_cluster.mongodb.net/your_database_name?retryWrites=true&w=majority`;

Replace your_cluster_name and your_database_name with your MongoDB cluster and database information accordingly

Running Locally

To run the project locally, use the Vercel CLI:

vercel dev

This will start the development server, and you can access the API at http://localhost:3000/api/your_endpoint.

Deployment

To deploy the project to Vercel, follow these steps:

  1. Log in to your Vercel account using the CLI:
vercel login
  1. Deploy your project to Vercel:
vercel

Vercel will automatically detect the configuration and deploy your project. You'll receive a deployment URL like this: https://your-project-name-your-username.vercel.app.

Learning Exercise

This API is part of a learning exercise from a course taught by Nicolás Schürmann, a software engineer and instructor known as "Hola Mundo." The project aims to reinforce the concepts and techniques taught in the course and to provide hands-on experience in building serverless applications with Vercel and MongoDB.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

vercel-mongodb-rest-api's People

Contributors

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