Demo: https://iot-tweets.herokuapp.com/
This project is a React app built with Create React App and a Node.js/Express server.
The Node.js/Express server gets 100 recent tweets with the hashtag #IoT using the Twitter Search API and makes them available to the React app at an API endpoint /tweets. The React app displays the 100 recent tweets along with a data visualization of the top twenty words used in those tweets.
- Clone the repo
git clone [email protected]:jamenamcinteer/iot-tweets.git
cd iot-tweets
-
Run
yarnin the rootiot-tweetsfolder -
Create a file
dev.jsin theconfigfolder with your Twitter API variables. It should be in the following format, where[variable]is your Twitter API variable:
module.exports = {
TWITTER_API_KEY: [twitter api key],
TWITTER_API_SECRET: [twitter api secret],
TWITTER_ACCESS_TOKEN_KEY: [twitter access token key],
TWITTER_ACCESS_TOKEN_SECRET: [twitter access token secret],
CORS_URL: "http://localhost:3001/"
};
- Run
yarn devto run the app in development mode. The React app will be athttp://localhost:3000and the Node server will be athttp://localhost:3001
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view the React app in the browser and http://localhost:3001/tweets to view the Node server endpoint for accessing tweets.
Launches the Jest test runner in watch mode.
Runs the Jest test runner once (not in watch mode) and displays a table with the project test coverage.
Builds the React app for production to the build folder.
yarn heroku-postbuild uses this script. Heroku uses yarn heroku-postbuild to build the React app during deployment. It then uses yarn start to start the server after the React build is complete.