This program is part of Final Project Capstone Design mandated as graduation requirement of Bachelor of Engineering program at Institut Teknologi Bandung. The whole project consists of this repository as the backend and a Flutter aplication as the frontend. This API server provides drivers to MongoDB Collections and provides Henon's Map and Arnold's Map generation for image encryption that are used to safely upload and store image from the Android application.
/api/verify
/api/perpanjangan
/api/map
- Install Node.js and Python 3.9.
- Make sure Python 3.9 can be called by using
python3
alias. - Make a
connectionString.txt
file on project's root folder. Put your MongoDB connection string inside it. - Install all Node.js dependencies by using npm.
npm install
- Install all Python dependencies by using pip.
python3 -m pip install --upgrade pip
python3 -m pip install -r ./requirement.txt
- Edit the
index.js
file. Look forconst isHTTPS
in line 26.
- Set the value to
false
if you want the server to only listen to port 80 (HTTP), or - Set the value to
true
to make the server listen to both port 80 (HTTP) and port 443 (HTTPS). Do note that you need to put your TLS certificate in lines 71-73 inindex.js
to use HTTPS, for example by using Let's Encrypt:
const privateKey = fs.readFileSync('/etc/letsencrypt/live/stnk-api-ta.tech/privkey.pem', 'utf8');
const certificate = fs.readFileSync('/etc/letsencrypt/live/stnk-api-ta.tech/cert.pem', 'utf8');
const ca = fs.readFileSync('/etc/letsencrypt/live/stnk-api-ta.tech/chain.pem', 'utf8');
-
Run the server. Linux need root access to open well-known ports.
sudo node index
Simply usenode index
on Windows.
This should showed up on your terminal.
-
Test the server by accessing
/api/test
. For example, if you are using it on localhost, try to openlocalhost/api/test
on your browser. You could also use the local ip, shown previously, to access it from your local network.
This should showed up:
WIP