remove server

This commit is contained in:
smolgrrr 2023-11-18 15:48:00 +11:00
parent 89ac48e37c
commit 7ec8071980
4 changed files with 0 additions and 69 deletions

2
server/.gitignore vendored
View File

@ -1,2 +0,0 @@
node_modules
bun.lockb

View File

@ -1,33 +0,0 @@
import express from 'express';
import bodyParser from 'body-parser';
import { minePow } from 'nostr-tools/lib/types/nip13';
const app = express();
const port = 3000;
// Use body-parser middleware to parse JSON requests
app.use(bodyParser.json());
app.post('/powgen', async (req, res) => {
try {
const { unsigned, difficulty } = req.body;
// Validate input
if (!unsigned || !difficulty) {
return res.status(400).send('Missing unsigned event or difficulty.');
}
// Call minePow function to generate PoW
const result = minePow(unsigned, difficulty);
// Send back the result
res.json(result);
} catch (error) {
console.error('Error generating PoW:', error);
res.status(500).send('Internal server error');
}
});
app.listen(port, () => {
console.log(`Server running at http://localhost:${port}`);
});

View File

@ -1,21 +0,0 @@
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "tsc",
"start": "node dist/index.js",
"dev": "tsc && node dist/index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@types/express": "^4.17.21",
"@types/node": "^20.9.1",
"express": "^4.18.2",
"nostr-tools": "^1.17.0",
"typescript": "^5.2.2"
}
}

View File

@ -1,13 +0,0 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"rootDir": "./",
"outDir": "./dist",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true
},
"include": ["src/**/*", "index.ts"],
"exclude": ["node_modules"]
}