-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update dependencies * Use Node's native fetch() * Upgrade redis * Update bin/update-server.js Co-authored-by: Black-Hole️ <github@bugs.cc> * Update package.json Co-authored-by: Black-Hole️ <github@bugs.cc> * Update src/updates.js Co-authored-by: Black-Hole️ <github@bugs.cc> * Update tests to Node 18 * Do not await res.text() --------- Co-authored-by: Black-Hole️ <github@bugs.cc>
- Loading branch information
1 parent
d660fdb
commit b4600b5
Showing
8 changed files
with
719 additions
and
603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const { createServer } = require("../test/helpers/create-server"); | ||
|
||
async function main() { | ||
const { server, address } = await createServer(); | ||
console.log(`Server running at ${address}`); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const Updates = require("../../src/updates"); | ||
|
||
class MemoryCache { | ||
constructor() { | ||
this.data = new Map(); | ||
} | ||
|
||
async get(key) { | ||
return this.data.get(key); | ||
} | ||
|
||
async set(key, value) { | ||
this.data.set(key, value); | ||
} | ||
} | ||
|
||
function createServer() { | ||
return new Promise((resolve) => { | ||
const updates = new Updates({ cache: new MemoryCache() }); | ||
const server = updates.listen(() => { | ||
resolve({ | ||
server, | ||
address: `http://localhost:${server.address().port}`, | ||
}); | ||
}); | ||
}); | ||
} | ||
|
||
module.exports = { | ||
createServer, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.