Welcome to the Pixel Punch-Out Server repository! This server manages player profiles, authentication, and other essential backend services for the Pixel Punch-Out game.
The Pixel Punch-Out Server is dedicated to handling player profiles, authentication, and other backend functionalities that support the main game logic handled by a separate WebSocket server. Built with Node.js and MySQL, it ensures secure and efficient management of player data.
- Player Profiles: Create and manage player profiles.
- Authentication: Secure user login and registration.
- Profile Interactions: Comment on player profiles, update profile photos, and more.
- Backend: Node.js, Express.js
- Database: MySQL
- ORM: Knex.js
Make sure you have the following installed:
- Node.js
- npm
- MySQL
-
Clone the repository:
git clone https://github.com/yigitocak/Pixel-Punch-Out-Server.git cd Pixel-Punch-Out-Server
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add your MySQL connection details and other necessary environment variables.DB_HOST=your_mysql_host DB_USER=your_mysql_user DB_PASSWORD=your_mysql_password DB_DATABASE=your_mysql_database BACKEND_URL=your_backend_url CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name DISCORD_CLIENT_ID=your_discord_client_id DISCORD_CLIENT_SECRET=your_discord_client_secret DISCORD_TOKEN=your_discord_token EMAIL=your_website_email EMAIL_PASSWORD=your_website_email_password GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret NODE_ENV=development_production SECRET_KEY=your_secret_key PORT=your_port_number
-
Run the server:
npm start
Once the server is running, it will handle player profiles, authentication, and other backend tasks. Connect your front-end or WebSocket server to this backend to utilize these services.
-
Authenticate Token:
GET /auth/ (header) { "token": "your_token" }
-
Register:
POST /auth/signup { "email": "your_email", "username": "your_username", "password": "your_password" }
-
Login:
POST /auth/login { "username": "your_username", "password": "your_password" }
-
Verify:
POST /auth/verify { "email": "your_email", "code": "your_code" }
-
Reset:
POST /auth/reset { "email": "your_email" }
-
Validate Reset:
POST /auth/validateReset { "email": "your_email", "code": "your_code" }
-
Reset Password:
POST /auth/resetPassword { "email": "your_email", "newPassword": "your_new_password", "secret": "your_secret" }
-
All Profiles:
GET /profiles/
-
Fetch Specific User With ID:
GET /profiles/id/:id
-
Fetch Specific User:
GET /profiles/:username
-
Change Username:
POST /profiles/username { "newUsername": "your_new_username" }
-
Upload Photo:
POST /profiles/:username/uploadPhoto { "file": "your_profile_photo" }
-
Delete Profile:
DELETE /profiles/:username
-
Increment Wins:
POST /profiles/:username/wins { "secret": "your_secret" }
-
Increment Losses:
POST /profiles/:username/losses { "secret": "your_secret" }
-
Post Comment:
POST /profiles/:username/comments { "commentUsername": "your_username", "comment": "your_comment" }
-
Delete Comment:
DELETE /profiles/:username/comments/:commentId
- Leaderboard:
GET /leaderboard
-
User Discord Data:
POST /discord/getuserData { "discordId": "your_discord_id" }
-
User Discord Verify:
GET /discord/verify
-
User Discord Verify Callback:
GET /discord/verify/callback
-
User Discord OAuth Login:
GET /discord/oauth/login
- Google Callback:
POST /oauth/google/callback { "token": "your_token" }
We welcome contributions! Here’s how you can help:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/your-feature
- Create a Pull Request.
Have questions or feedback? Let’s connect!