Built using Node.js as an API endpoint for the main Face-Recognition-App containing the front-end faceapp.sivaramp.com
It provides all the functionality that the front end is expecting on fetching data from the Clarifai API.
It takes care of the various functions associated with different requests and routes the requests and responses accordingly. It is also built with security in focus so as to ensure no sensitive information is exposed in requests or responses or even the console.
-
Clone this repo
-
Go to Face-Recognition-App-API This is the main project folder for the front end.
-
Run npm install This will install all the dependencies.
-
You must add your own API key in the
controllers/image.js
file to connect to Clarifai.
You can grab Clarifai API key here
-
Run npm start This will run the server, on port 3000
-
Go to Face-Recognition-App & Clone the repo. This is the Main App i.e. the front-end for the application
-
Run npm install This will install all the dependencies.
-
Then run npm start Press Y when prompted for using another port (Since 3000 is default for create-react-app module and it is occupied) It will use the port 3001
** Make sure you use postgreSQL instead of mySQL for this code base.
-
Create a database face-recog
-
Create table users and login, with following structure: (Generated using \d tb_name in psql)
Table "public.users"
Column | Type | Modifiers |
---|---|---|
id | integer | not null default nextval('users_id_seq'::regclass) |
name | character varying(100) | |
text | not null | |
entries | bigint | default 0 |
joined | timestamp without time zone | not null |
Indexes: "users_pkey" PRIMARY KEY, btree (id) "users_email_key" UNIQUE CONSTRAINT, btree (email)
Table "public.login"
Column | Type | Modifiers |
---|---|---|
id | integer | not null default nextval('login_id_seq'::regclass) |
hash | character varying(100) | not null |
text | not null |
Indexes: "login_pkey" PRIMARY KEY, btree (id) "login_email_key" UNIQUE CONSTRAINT, btree (email)
- Enter user and password for the database in server.js