Skip to content

anuragpoolakkal/campus-api

Repository files navigation

Campus API Setup Documentation

This setup documentation provides step-by-step instructions for setting up the Campus API on your local development environment.

Prerequisites

Before you begin, ensure you have the following software installed on your system:

Step 1: Clone the Repository

  1. Open your terminal or command prompt.

  2. Change the current working directory to the location where you want to clone the repository.

  3. Run the following command to clone the Campus API repository:

    git clone <repository_url>
    

Step 2: Install Dependencies

  1. Navigate to the root directory of the cloned repository.

  2. Run the following command to install dependencies:

    npm install
    

Step 3: Configure Environment Variables

  1. In the root directory of the project, create a .env file.

  2. Define the following environment variables in the .env file:

    PORT=3000
    MONGODB_URI=mongodb://localhost:27017/campusDB
    TOKEN_SECRET=some_secret_key
    
    • PORT: The port number on which the server will run.
    • MONGODB_URI: The connection URI for your MongoDB database.
    • TOKEN_SECRET: A secret key used to sign and verify JSON Web Tokens (JWTs).

Step 4: Start MongoDB

  1. Start MongoDB service on your local machine. Use the following command:

    mongod
    

Step 5: Start the Server

  1. Run the following command to start the server:

    npm start
    

    This command will start the Express server, and you should see a message indicating that the server is running on the specified port.

Step 6: Access the Campus API

  1. Open your web browser.
  2. Visit http://localhost:3000 to access the Campus API.
  3. You should now be able to use the Campus API on your local machine.

Additional Notes

  • Make sure to replace <repository_url> in Step 1 with the actual URL of the Campus API repository.
  • Ensure that MongoDB is running before starting the server to establish a connection with the database.
  • Customize the .env file according to your specific configuration requirements.
  • For production deployment, consider configuring additional settings such as security measures, logging, and environment variables specific to your deployment environment.

By following these steps, you should be able to set up the Campus API on your local machine and start developing or testing it.