NUSphere is comprehensive, user-friendly web application that serves as a one-stop portal for all NUS-related events. Students can both publicise and find out events of their interests easily with the filter functions. Our goal is to simplify how events are shared, discovered, and managed, ensuring that no valuable opportunity for learning, networking, or socialising is missed.
Ensure you have the following installed:
- Golang (>= 1.16)
- Node.js (>= 14.x)
- PostgreSQL (>= 12.x)
- Git
- Clone the repository:
git clone https://github.com/anselmlong/nusphere.git cd nusphere/go-backend - Install dependencies:
go mod tidy
- Configure the environment variables:
Create a .env file in the backend directory with the following content:
DATABASE_URL=postgres://youruser:yourpassword@localhost:5432/yourdb?sslmode=disable - Create the events, users and bookmarks table in PostgreSQL:
CREATE TABLE events ( id SERIAL PRIMARY KEY, title VARCHAR(255), date VARCHAR(50), description TEXT, image_url VARCHAR(255), type VARCHAR(50), price VARCHAR(50), organizer VARCHAR(100), start_time TIME, end_time TIME, registration_link VARCHAR(255), location VARCHAR(100), user_id INT REFERENCES users(id) ); CREATE TABLE users ( id SERIAL PRIMARY KEY, google_id VARCHAR(255) UNIQUE NOT NULL, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, ); CREATE TABLE bookmarks ( id SERIAL PRIMARY KEY, user_id INT NOT NULL, event_id INT NOT NULL, FOREIGN KEY (user_id) REFERENCES users(id), FOREIGN KEY (event_id) REFERENCES events(id) );
- Run the backend server:
go run main.go
- Install dependencies:
npm install
- Run the frontend development server:
npm start
- Start the backend server by running the command in the backend directory:
go run main.go
- Start the frontend development server by running the command in the frontend directory:
npm start
- Open your browser and navigate to http://localhost:3000 to view the application.
GET /events: Retrieve all events.
POST /events: Create a new event.
PUT /events/: Update an existing event.
DELETE /events/: Delete an event.
This project is licensed under the MIT License - see the LICENSE file for details.