2022-02-15 14:46:24 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2022-02-15 14:46:24 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2021-11-15 17:21:44 +08:00
2021-11-15 17:21:44 +08:00
2020-09-11 14:00:50 +08:00
2020-09-11 14:00:50 +08:00
2022-01-12 06:05:23 +00:00
2021-10-18 17:47:56 +08:00
2020-09-11 14:00:50 +08:00

BioProAPIServer

Setup pi3 postgresql

Switch to the Postgres user to configure the database
sudo su postgres
Create a database user 'biopro' with password 'BioProControlBox'
createuser biopro -P --interactive
Postgres command (type psql first to connect postgres)
#Find databases
\l

#Find tables
\dt

Run apiServer on device

Install node.js
sudo apt-get upgrade
sudo apt-get update
### setup_14.x can change to your version
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
### install node and npm
sudo apt-get install -y nodejs
(optional) if the installation of node.js fail
sudo apt update
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Clone project
git clone https://gitlab.com/bioproscientific/bioproapiserver.git
Change config port
cd ~/bioproapiserver/src
vim config.js

change the code following as:

export const pgDB = {
  host: '127.0.0.1', // 服务器地址
  port: 5432, // 数据库端口号
  username: 'biopro', // 数据库用户名
  password: 'BioProControlBox', // 数据库密码
  database: 'postgres' // 数据库名称
}
Init setup project && build dist app
cd ~/bioproapiserver
npm install
npm run build
Auto run program when pi-start
sudo vim /etc/rc.local

add the code following as:

now=$(date +"%F_%T")
sudo -H -u pi nohup node /home/pi/bioproapiserver/dist/app.js > /home/pi/.api_server_$now.out &

Localhost develop

Localhost test port binding (your device:54321 -> raspberrypi:5432)
ssh -NL 54321:localhost:5432 pi@your-pi3-ip
Run apiServer on your localhost (remember binding port first)
git clone https://gitlab.com/bioproscientific/bioproapiserver.git
cd bioproapiserver
npm install
npm run start
References

https://opensource.com/article/17/10/set-postgres-database-your-raspberry-pi

S
Description
No description provided
Readme WTFPL 1 MiB
Languages
JavaScript 95.1%
Python 4.5%
Dockerfile 0.3%