Articles on: SomethingCP Guides

How to use our subdomain system for your Discord bot

Welcome to SomethingHost!


In this guide, you will learn how to use our subdomain system for your own Discord bot hosting package.



So how it works?


So let's see what this is first of all. Let's say your service with ID 1234 is located on an IP address. Let's say AAA.BBB.CCC.DDD. In order to connect to your service to use a webhook for example, or a voting endpoint for a Discord bot list you may use, you would go to the IP address and connect. Now, that IP is not publicly available due to how our system works, so to connect to your service you would go to https://service-1234.something.gg/. This subdomain essentially connects you to AAA.BBB.CCC.DDD:2000, so to listen to connections you would have to adjust your service to listen to port 2000.

Express.JS with NodeJS example


const express = require('express');
const app = express();
const port = 2000;

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`)
})


The end result

Updated on: 28/12/2022

Was this article helpful?

Share your feedback

Cancel

Thank you!