DEV Community

Cover image for Create API Using AWS Rekognition to return detected faces in uploaded image - Nodejs & React
Vlladie Condeno
Vlladie Condeno

Posted on

Create API Using AWS Rekognition to return detected faces in uploaded image - Nodejs & React

Objective: user can upload image and it will return the list of detected faces.

You can visit the repo here and fork it and try it yourself!
or you can follow the instruction below

1. Clone the repo by running in your cmd

$ git clone https://github.com/VLDCNDN/face-rekognition-app.git
$ cd face-rekognition-app
$ npm install

Enter fullscreen mode Exit fullscreen mode
2. Copy .env.copy file then paste it in the same level of the copied file, rename the file into .env

step2 image

3. Open .env file and make sure that the 2 value exist

Step3

Make sure that you already configure the AWS Credential ENV because the app will not run without it

Now you can run it's API

Here's the URL for the API

# REQUEST
POST /api/detect-faces
body {
   "image": "base64 image"
}

# RESPONSE FORMAT
{
  "data" : [
     "base64 image",
     ...
   ]
}
Enter fullscreen mode Exit fullscreen mode

Response


If you want to use the front end

within the same repo, run

cd client && npm install

now try running

npm start

make sure that you're under client folder

now you can see this (localhost:3000)
Result

If you only want the backend, you can just delete the client folder

NOTE: Make sure that your nodejs/express is running in port of 3001 since the proxy set in reactjs is 3001 for backend, just change the reactjs proxy url if you wanted the backend running different port
Port

Top comments (0)