An expressJS application, which is a REST API
● User logins using a username and password
● Create a user account using username / password
● Discard the JWT Token used for logging in to the system
● Upload a new task to fetch latest tweets for the hashtag - #Bangalore
● List out all the tasks which were executed successfully/scheduled to be queued, and provide the metadata, such as how much time did it take to execute, status code, number of tweets fetched. Ignore for tasks, which are not completed
● List out the tasks which are completed. Same as /tasks/listTask but shows only completed tasks.
● Twitter API Essential Access (sign up here)
● A Project and an App created in the dashboard
npm install bcrypt
npm install express
npm install passport
npm install passport-jwt
npm install jsonwebtoken
npm install mongoose
npm install needle
Key | Value | Description |
---|---|---|
query |
#Bangalore |
each query to submit to the recent search endpoint |
● Start the server
npm app.js
or
npm start
● You can use Postman to test my API authentication
● First we will register the user with a post request with the URL
http://localhost:3000/user/register
in the body add two key value pairs
Key | Value |
---|---|
email |
emailid@email.com |
password |
password |
● We will login with the registered user
Post request with the following URL
http://localhost:3000/user/login
in the body add two key value pairs
Key | Value |
---|---|
email |
emailid@email.com |
password |
password |
● Once Authenticated , a JWT token is sent back as a response to the POST request this JWT token is mandatory for further authorisation to create tasks
● We will GET request with the following URL
http://localhost:3000/tasks/createTask
in the params section add two key value pairs
Key | Value |
---|---|
secret_token |
your JWT token |
hashtag |
keyword that you want to search |
Result will be displayed in the Terminal
This project helped me in creating, understanding the working and testing of twitter API.