General: add general API route for fetching key messages
This commit is contained in:
parent
c5615feace
commit
592a2beca1
|
@ -1,10 +1,25 @@
|
||||||
const express = require("express")
|
const express = require("express")
|
||||||
|
const body_parser = require("body-parser")
|
||||||
|
const base = require("base-64")
|
||||||
|
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
const PORT = 443
|
const PORT = 443
|
||||||
|
|
||||||
|
// express configuration
|
||||||
|
app.use(body_parser.urlencoded({
|
||||||
|
extended: true
|
||||||
|
}))
|
||||||
|
|
||||||
app.get("/", (req, res) => {
|
// Backend - Routes
|
||||||
res.send("hello world\n");
|
|
||||||
|
// API - Routes
|
||||||
|
app.post("/client-fetch-keys", (req, res) => { // client sends here the keys
|
||||||
|
let keys = req.body.keys
|
||||||
|
console.log(base.decode(keys));
|
||||||
|
|
||||||
|
|
||||||
|
res.send("PIVOTER_OK\n");
|
||||||
})
|
})
|
||||||
|
|
||||||
app.listen(PORT)
|
app.listen(PORT)
|
1676
backend/package-lock.json
generated
1676
backend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -4,11 +4,14 @@
|
||||||
"description": "backend for the pivoter server",
|
"description": "backend for the pivoter server",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"start": "node .",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"author": "osamu-kj",
|
"author": "osamu-kj",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^4.18.2"
|
"base-64": "^1.0.0",
|
||||||
|
"express": "^4.18.2",
|
||||||
|
"mongodb": "^4.12.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
11
database/docker-compose.yml
Normal file
11
database/docker-compose.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
version: '3.1'
|
||||||
|
|
||||||
|
services:
|
||||||
|
mongo:
|
||||||
|
image: mongo
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
MONGO_INITDB_ROOT_USERNAME: root
|
||||||
|
MONGO_INITDB_ROOT_PASSWORD: root
|
||||||
|
ports:
|
||||||
|
- 27017:9283
|
11986
frontend/package-lock.json
generated
11986
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,8 @@
|
||||||
"@testing-library/jest-dom": "^5.16.5",
|
"@testing-library/jest-dom": "^5.16.5",
|
||||||
"@testing-library/react": "^13.4.0",
|
"@testing-library/react": "^13.4.0",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
|
"base-64": "^1.0.0",
|
||||||
|
"body-parser": "^1.20.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user