This README provides instructions on how to set up and run the backend for the OpenSoft 2024 project using Go and the Gin web framework.
- Go (version 1.14 or later)
- Git (for version control)
-
Clone the Repository
Clone the project repository to your local machine using Git:
git clone https://github.com/[your-username]/opensoft-2024.git cd opensoft-2024
Replace
[your-username]
with your actual GitHub username or organization where the repository is hosted. -
Install Dependencies
Navigate to the backend directory and install the necessary Go modules:
cd backend go mod tidy
go mod tidy
will automatically add missing and remove unused modules. -
Configuration
Before running the server, ensure that you have the necessary configuration in place. The database credentials are stored in the
db.go
file. Make sure to review and update these credentials according to your database setup. -
Running the Server
Start the backend server using the following command:
go run main.go
This will start the server on
localhost:8080
and will include the following routes for CRUD operations:[Routes details omitted for brevity]
-
Security Warning
Be aware of the security implications of trusting all proxies. For production, configure the trusted proxies appropriately. Refer to the official Gin documentation for more details.
This section provides instructions on how to set up and run the frontend for the OpenSoft 2024 project using React and Vite.
- Node.js
- npm (or Yarn)
-
Navigate to the Frontend Directory
If you are in the project's root directory:
cd frontend
-
Install Vite (If Not Already Installed)
npm install -g create-vite
-
Create a New React Project (If Starting From Scratch)
npm create vite@latest my-react-app -- --template react cd my-react-app
-
Install Dependencies
npm install
-
Configure the Development Server
To use port 5173, modify
vite.config.js
:import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; export default defineConfig({ plugins: [react()], server: { port: 5173 } });
-
Run the Frontend Development Server
Start the server with:
npm run dev
The React application will now be running on http://localhost:5173.
To run the frontend of the OpenSoft 2024 project, navigate to the frontend directory, install the dependencies if not done already, and start the development server:
- Open a terminal and navigate to the frontend directory of your project.
- Install the necessary dependencies by running
npm install
. - Start the development server on the specified port (5173) with
npm run dev
. - Access the frontend in your browser at
http://localhost:5173
.