Backend repository for Trogs application for Oktane Hackathon.
- Clone this repo.
- Download config.js into the cloned Backend folder from here
- Download config.ini into the cloned Worker folder from here
- Download config.env into the cloned DockerDBSetup folder from here.
- Run
$ docker network create trogsNetwork
- Then
cd
into DockerDBSetup folder and rundocker-compose up
- Then open a new terminal and cd back into the main folder and again run
docker-compose up
. - Setup Complete 👍
Overview
- From frontend an accessToken will be sent in Header of each request, then Authorization handler middleware as defined in auth.js file check if the request is valid and put the JWT of the user as returned by Okta in to req.jwt and similarly for email and uid.
- We will be identifying a user by it's unique uid in our database.
.
Without Frontend
- To test the backend API's we need a valid accessToken, to do that open the accessToken.html by creating a server in python by following these steps (first ensure either you are logged out of all Okta services or either perform the browser steps in Incognito Mode):
- On terminal run (from python2), run this in the folder containing the code:
$ python -m SimpleHTTPServer
-
Now open http://localhost:8000 in Incognito and open accessToken.html with Console of Browser open.
-
Log into your Okta account, after logging in the accessToken will be logged in console. Copy that token and place it in accessToken variable in test.sh file.
-
Install httpie on your system.
-
Then you can manipulate test.sh to test different API's by changing the url and type of request. You can read the docs of httpie for help.
{
"friends": [],
"logs": [
{
"amount": 1000,
"boolPersonal": false,
"category": "Personal",
"completeLog": "Message for testing hey are you there this is agin done.",
"msgRefId": "123456789",
"secUsername": "",
"title": "Testing log title: Messag",
"uniqueRefId": "07f784ae0abc5048d4c53aa38591687f8d268bdd1007a60bfab9ba59"
}
],
"thumbnailUrl": "https://www.gravatar.com/avatar/6a10c16fdcb96765e4ebf1a483e31360?d=robohash",
"username": "vaibhav.thakkar.22.12.99@gmail.com"
}
=> Implement search API.
=> Deploy.
=> Define function for data extraction from SMS in python.