mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
* refactor(proxy): rely on auth header instead * chore: typo * chore: language Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> * chore: more language Co-authored-by: Aura Román <kyradiscord@gmail.com> * chore: more language nitpicks Co-authored-by: ckohen <chaikohen@gmail.com> * fix: unnecessary async --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: Aura Román <kyradiscord@gmail.com> Co-authored-by: ckohen <chaikohen@gmail.com>
12 lines
462 B
TypeScript
12 lines
462 B
TypeScript
import { createServer } from 'node:http';
|
|
import process from 'node:process';
|
|
import { proxyRequests } from '@discordjs/proxy';
|
|
import { REST } from '@discordjs/rest';
|
|
|
|
// We want to let upstream handle retrying
|
|
const api = new REST({ rejectOnRateLimit: () => true, retries: 0 });
|
|
const server = createServer(proxyRequests(api));
|
|
|
|
const port = Number.parseInt(process.env.PORT ?? '8080', 10);
|
|
server.listen(port, () => console.log(`Listening on port ${port}`));
|