commit
85205593e4
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
bun.lockb
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"typescript": {
|
||||
"quoteStyle": "preferSingle"
|
||||
},
|
||||
"includes": ["src/**/*.{ts,tsx,js,jsx,cjs,mjs,json}"],
|
||||
"excludes": [
|
||||
"**/node_modules"
|
||||
],
|
||||
"plugins": [
|
||||
"https://plugins.dprint.dev/typescript-0.88.1.wasm"
|
||||
]
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "labyrinth",
|
||||
"module": "src/server.ts",
|
||||
"type": "module",
|
||||
"scripts": {},
|
||||
"devDependencies": {
|
||||
"bun-types": "^1.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"msgpack-rpc-node": "^0.1.0-alpha.3"
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import { Client, TcpClient } from 'msgpack-rpc-node';
|
||||
|
||||
const RPC_PORT = 9000;
|
||||
const client = new Client(TcpClient, RPC_PORT);
|
||||
await client.connect();
|
||||
|
||||
const server = Bun.serve({
|
||||
port: 3000,
|
||||
fetch(request) {
|
||||
const url = new URL(request.url);
|
||||
switch (url.pathname) {
|
||||
case '/run':
|
||||
client.call('Add', 'echo $(( 1 + 2 ))', 'msh').then(console.log);
|
||||
return new Response('Your code is running...');
|
||||
default:
|
||||
return new Response('404!', { status: 404 });
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(`Listening on http://localhost:${server.port}`);
|
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./src",
|
||||
"types": ["bun-types"],
|
||||
|
||||
"lib": ["esnext"],
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
|
||||
"moduleResolution": "bundler",
|
||||
"noEmit": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"moduleDetection": "force",
|
||||
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"skipLibCheck": true,
|
||||
"composite": true,
|
||||
"downlevelIteration": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
}
|
||||
}
|
Loading…
Reference in new issue