This server is intended to be used alongside the RPG Viewer Client
Follow these steps to set up the RPG Viewer Server:
- MongoDB Setup
- Option 1: Install MongoDB locally and create a new database.
- Option 2: Use an existing MongoDB instance (local or cloud, e.g., MongoDB Atlas).
- Configure Environment Variables
- Copy the
.env.examplefile to.envin the project root. - Update the values in
.envas needed:MONGODB_URL: your MongoDB connection string.PORT: the port number for the server (e.g.,3000).
- Install Dependencies
npm install- Start the Server
npm startThe server should now be running and connected to your MongoDB database.
Make sure to note the server's public IP address and the port number you configured. You will need these details when setting up the frontend application to connect to the server.
If you are running the server on your local machine and want to access it from other devices or over the internet, you may need to set up port forwarding on your router:
- Log in to your router's admin panel.
- Locate the port forwarding section.
- Forward the port you configured for the server (e.g.,
3000) to your local machine's IP address. - Save the changes and restart your router if necessary.
Note: Exposing your server to the internet can have security implications. Ensure you understand the risks and consider using a firewall or VPN for additional protection.
You can manage your MongoDB data using either a graphical interface or command-line tools:
-
MongoDB Compass (GUI):
MongoDB Compass is an official GUI for MongoDB. It allows you to visually explore your data, run queries, and manage collections and documents without writing code. -
Mongo Shell (CLI):
The MongoDB Shell is an interactive JavaScript interface to MongoDB. You can use it to connect to your database, run queries, and perform administrative tasks from the command line.
For more information, refer to the official documentation for MongoDB Compass and the MongoDB Shell.