Skip to content

03 Running the Server

Alexander Epolite edited this page Jan 6, 2024 · 1 revision

Running the Server

After you have downloaded and configured the server, you can run it by issuing the following commands:

# cd into where you downloaded the repository

# compile the TypeScript into JavaScript
./node_modules/typescript/bin/src

# run the server
node ./dist/BCAPI.js

Testing the server

You should have a working server now! You can test this by using the curl command:

# replace 8080 with the port you are using and your-image.png with an image you want to test on the swirl filter.
curl -X POST localhost:8080/image/swirl --data-binary "@your-image.png" --output - > imagefilterapi-test-output.png

Open it up, and you should have a swirl'd image!

Running in the background

If you are hosting this on a VPS or something similar, I recommend using pm2 to run the server in the background.

You can start the process on pm2 using pm2 start ./dist/BCAPI.js, and it will auto-detect the package and version.

Clone this wiki locally