Compare commits

...

3 Commits

Author SHA1 Message Date
HSIN-CHUAN HUANG be5e385ae0 Update README.md 2021-11-11 08:56:36 +00:00
Jordan Hsu 363d8aac11 [fix] delete bug 2021-10-18 17:47:56 +08:00
peterlu14 a7bea5288c [update] recover route device/update/:id 2021-09-23 18:31:08 +08:00
4 changed files with 26 additions and 16 deletions
+20 -8
View File
@@ -1,6 +1,11 @@
# BioProAPIServer
### Setup pi3 postgresql
### Setup postgresql
##### Installation
```
sudo apt-get install postgresql libpq-dev postgresql-client postgresql-client-common
```
##### Switch to the Postgres user to configure the database
```
@@ -14,11 +19,18 @@ createuser biopro -P --interactive
##### Postgres command (type psql first to connect postgres)
```
#Enter postgresql
psql
#Find databases
\l
#Find tables
\dt
# Create new database and table if you need
create database test
test=> create table people (name text, company text)
```
### Run apiServer on device
@@ -39,11 +51,11 @@ change the code following as:
change apiserver port to postgres port, 54321 --> 5432 (default)
*/
export const pgDB = {
host: '127.0.0.1', // 服务器地址
port: 54321, // 数据库端口号 -----------------> 5432
username: 'biopro', // 数据库用户名
password: 'BioProControlBox', // 数据库密码
database: 'postgres' // 数据库名称
host: '127.0.0.1',
port: 54321, // -----------------> 5432
username: 'biopro',
password: 'BioProControlBox',
database: 'postgres'
}
```
@@ -67,7 +79,7 @@ nohup node /home/pi/bioproapiserver/dist/app.js > /home/pi/.api_server.out &
##### Localhost test port binding (your device:54321 -> raspberrypi:5432)
```
ssh -NL 54321:localhost:5432 pi@your-pi3-ip
ssh -NL 54321:localhost:5432 pi@your-pi-ip
```
##### Run apiServer on your localhost (remember binding port first)
@@ -79,4 +91,4 @@ npm run start
```
##### References
>https://opensource.com/article/17/10/set-postgres-database-your-raspberry-pi
>https://opensource.com/article/17/10/set-postgres-database-your-raspberry-pi
+2 -8
View File
@@ -62,14 +62,8 @@ class RecordingDataMeta {
recordingDataRaw.clearDeleted(channel)
}
if (meta.mini_data[channel] != null) {
if (meta.mini_data[channel]['10'] !== undefined) {
await recordingDataMini.updateByIDs({ deleted: true }, meta.mini_data[channel]['10'], channel)
}
if (meta.mini_data[channel]['100'] !== undefined) {
await recordingDataMini.updateByIDs({ deleted: true }, meta.mini_data[channel]['100'], channel)
}
if (meta.mini_data[channel]['1000'] !== undefined) {
await recordingDataMini.updateByIDs({ deleted: true }, meta.mini_data[channel]['1000'], channel)
for (const miniID in meta.mini_data[channel]) {
await recordingDataMini.updateByIDs({ deleted: true }, meta.mini_data[channel][miniID], channel)
}
recordingDataMini.clearDeleted(channel)
}
+1
View File
@@ -72,6 +72,7 @@ export default router
// device
.post('/api/device/create', controllers.device.create)
.post('/api/device/update/:id', controllers.device.update)
.post('/api/device/update/all', controllers.device.update)
.post('/api/device/update_by_id/:id', controllers.device.updateByID)
.post('/api/device/update_by_mac/:mac', controllers.device.updateByMac)
+3
View File
@@ -0,0 +1,3 @@
# Elite: 53
# Neulive: 101 or 95
ssh -NL 54321:localhost:5432 pi@192.168.2.1