mirror of
https://github.com/smolgrrr/TAO.git
synced 2024-09-20 01:11:25 +00:00
remove server
This commit is contained in:
parent
89ac48e37c
commit
7ec8071980
2
server/.gitignore
vendored
2
server/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
node_modules
|
||||
bun.lockb
|
@ -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}`);
|
||||
});
|
@ -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"
|
||||
}
|
||||
}
|
@ -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"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user