Skip to content

toledompm/tweet-fetcher

Repository files navigation

Description

API to fetch and save tweets that contain a given #hashtag

Setup

# This application requires some auth keys from the twitter api
# You can fill them out in the .env file
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_TOKEN_SECRET=
TWITTER_API_KEY=
TWITTER_API_KEY_SECRET=

Installation

$ npm install

Run migrations

# Start database
$ make db-up

# Build app (typeorm looks for entities/migrations in the dist/ directory)
$ npm run build

# Run migrations
$ npm run migration:run

Running the app

# Development
$ make db-up
$ npm run start:dev

# Running the app on docker-container
# Change .env DB_HOST to db
$ docker-compose up

Send requests!

GET @ localhost:3000/tweet/:hashtag

example response:

{
    "twitterId": "1234",
    "body": "this is a tweet with a #hashtag",
    "hashtags": [
        {
            "text": "hashtag",
            "searchHashtag": true
        }
    ],
    "id": 3
}

Test

# unit tests
$ npm run test

# test coverage
$ npm run test:cov

Created with: Nest framework TypeScript starter repository.

About

Finds latest tweets that contain a given hashtag and saves them

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors