My First Node.js App

Screenprint of App

Here are the instructions for my 1st Node app.

My repo
# LIRI Bot

### Overview

In this assignment, you will make LIRI. LIRI is like iPhone’s SIRI. However, while SIRI is a Speech Interpretation and Recognition Interface, LIRI is a _Language_ Interpretation and Recognition Interface. LIRI will be a command line node app that takes in parameters and gives you back data.

### Before You Begin

1. LIRI will display your latest tweets. As we do not want to display your personal account, or its keys, please make an alias account and add a few tweets to it!

2. Make a new GitHub repository called liri-node-app and clone it to your computer.

3. To retrieve the data that will power this app, you’ll need to send requests to the Twitter, Spotify and OMDB APIs. You’ll find these Node packages crucial for your assignment.

* [Twitter](https://www.npmjs.com/package/twitter)

* [Node-Spotify-API](https://www.npmjs.com/package/node-spotify-api)

* [Request](https://www.npmjs.com/package/request)

* You’ll use Request to grab data from the [OMDB API](http://www.omdbapi.com).

* [DotEnv](https://www.npmjs.com/package/dotenv)

### Submission on BCS

* Please submit the link to the Github Repository!

### Instructions

1. Navigate to the root of your project and run `npm init -y` — this will initialize a `package.json` file for your project. The `package.json` file is required for installing third party npm packages and saving their version numbers. If you fail to initialize a `package.json` file, it will be troublesome, and at times almost impossible for anyone else to run your code after cloning your project.

2. Make a .gitignore file and add the following lines to it. This will tell git not to track these files, and thus they won’t be committed to Github.

“`
node_modules
.DS_Store
.env
“`

3. Make a JavaScript file named `keys.js`.

* Inside keys.js your file will look like this:

“`js
console.log(‘this is loaded’);

exports.twitter = {
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY,
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET
};

exports.spotify = {
id: process.env.SPOTIFY_ID,
secret: process.env.SPOTIFY_SECRET
};
“`

4. Next, create a file named `.env`, add the following to it, replacing the values with your API keys (no quotes) once you have them:

“`js
# Spotify API keys

SPOTIFY_ID=your-spotify-id
SPOTIFY_SECRET=your-spotify-secret

# Twitter API keys

TWITTER_CONSUMER_KEY=your-twitter-consumer-key
TWITTER_CONSUMER_SECRET=your-twitter-consumer-secret
TWITTER_ACCESS_TOKEN_KEY=your-access-token-key
TWITTER_ACCESS_TOKEN_SECRET=your-twitter-access-token-secret

“`

* This file will be used by the `dotenv` package to set what are known as environment variables to the global `process.env` object in node. These are values that are meant to be specific to the computer that node is running on, and since we are gitignoring this file, they won’t be pushed to github — keeping our API key information private.

* If someone wanted to clone your app from github and run it themselves, they would need to supply their own `.env` file for it to work.

5. Get your Twitter API keys by following these steps:

* Step One: Visit

* Step Two: Fill out the form with dummy data. Type `http://google.com` in the Website input. Don’t fill out the Callback URL input. Then submit the form.

* Step Three: On the next screen, click the Keys and Access Tokens tab to get your consume key and secret.

* Copy and paste them into your .env file, replacing the `your-twitter-consumer-key` and `your-twitter-consumer-secret` placeholders.

* Step Four: At the bottom of the page, click the `Create my access token` button to get your access token key and secret.

* Copy the access token key and secret displayed at the bottom of the next screen. Paste them into your .env file, replacing the placeholders for `your-twitter-access-token-key` and `your-twitter-access-token-secret`.

6. Make a file called `random.txt`.

* Inside of `random.txt` put the following in with no extra characters or white space:

* spotify-this-song,”This is America”

7. Make a JavaScript file named `liri.js`.

8. At the top of the `liri.js` file, add code to read and set any environment variables with the dotenv package:

“`js
require(“dotenv”).config();
“`

9. Add the code required to import the `keys.js` file and store it in a variable.

* You should then be able to access your keys information like so

“`js
var spotify = new Spotify(keys.spotify);
var client = new Twitter(keys.twitter);
“`

10. Make it so liri.js can take in one of the following commands:

* `my-tweets`

* `spotify-this-song`

* `movie-this`

* `do-what-it-says`

### What Each Command Should Do

1. `node liri.js my-tweets`

* This will show your last 20 tweets and when they were created at in your terminal/bash window.

2. `node liri.js spotify-this-song ”`

* This will show the following information about the song in your terminal/bash window

* Artist(s)

* The song’s name

* A preview link of the song from Spotify

* The album that the song is from

* If no song is provided then your program will default to “Apeshit” by The Carters.

* You will utilize the [node-spotify-api](https://www.npmjs.com/package/node-spotify-api) package in order to retrieve song information from the Spotify API.

* Like the Twitter API, the Spotify API requires you sign up as a developer to generate the necessary credentials. You can follow these steps in order to generate a **client id** and **client secret**:

* Step One: Visit

* Step Two: Either login to your existing Spotify account or create a new one (a free account is fine) and log in.

* Step Three: Once logged in, navigate to to register a new application to be used with the Spotify API. You can fill in whatever you’d like for these fields. When finished, click the “complete” button.

* Step Four: On the next screen, scroll down to where you see your client id and client secret. Copy these values down somewhere, you’ll need them to use the Spotify API and the [node-spotify-api package](https://www.npmjs.com/package/node-spotify-api).

3. `node liri.js movie-this ”`

* This will output the following information to your terminal/bash window:

“`
* Title of the movie.
* Year the movie came out.
* IMDB Rating of the movie.
* Rotten Tomatoes Rating of the movie.
* Country where the movie was produced.
* Language of the movie.
* Plot of the movie.
* Actors in the movie.
“`

* If the user doesn’t type a movie in, the program will output data for the movie ‘Mr. Nobody.’

* You’ll use the request package to retrieve data from the OMDB API. Like all of the in-class activities, the OMDB API requires an API key.

4. `node liri.js do-what-it-says`

* Using the `fs` Node package, LIRI will take the text inside of random.txt and then use it to call one of LIRI’s commands.

* It should run `spotify-this-song` for “This is American,” as follows the text in `random.txt`.

* Feel free to change the text in that document to test out the feature for other commands.

### BONUS

* In addition to logging the data to your terminal/bash window, output the data to a .txt file called `log.txt`.

* Make sure you append each command you run to the `log.txt` file.

* Do not overwrite your file each time you run a command.

Advertisements

I’ve had a very productive Fall learning about Web Development

I’ve been a very busy girl this fall. Immersing myself into all things web development has all but consumed me. I’ve gained a few pounds, missed several workouts and my meal prep is all but non-existent. However, don’t pity me, be happy for me! I’ve been getting busy, learning so much about so much, I don’t know where to start.

I guess starting at the beginning of the semester is a good place.

This fall, I took a Usability and User Experience class. We learned theory of UX, lo-fi and hi-fi prototyping, colors, story boards, icon design, user testing, onboarding, style guides and so much more. Our final project was an app rebranding for a bike share company.

The instructor, Michael Estok, was a joy to learn from. He works full-time as a freelance UX designer in the Philadelphia area. I took this class because the one I wanted to take wasn’t being offered, and I’m very glad I did.  He made UX approachable, fun, social and less of a mystery. I’m not the design-y type, but he encouraged and pushed us all into making some pretty cool projects.

App loading screen

Loading Screen

Here is my final project.  I passed the class!

Also on my schedule this fall was classes with GDI. I’m a member of Girl Develop It Philly and I TA’d my first class this fall. I also took a few classes with them. I took Intro to Git & Github and HTML/ CSS 202: Flexbox Layouts.  I met some nice ladies and was introduced to Github! How DOPE is that!

I also gave my 1st talk!!! I attended BarCamp Philly and threw my hat in the ring to give a talk. Thanks Michael for bringing it up just 2 days before. I faced a room full of people who came to hear me (ME!!). My topic was called, ” If you sit at a screen all day, what is your self-care regimen?”. If I was going to say anything, it was going to be something that is familiar to me.  I was nervous, chatty, but the group was fun and very engaged. after 45 minutes, I survived! We came up with a great list of things we could all do to raise our wellness IQ (see below). At the end, we stretched.  The sounds and groans of stiff bodies warmed my heart! They listened and even learned a thing or 2.

 

//platform.twitter.com/widgets.js

Self-Care Regimen

While this was going on,  I also signed up for Coursera’s Full Stack Web Development Specialization online. With a 6 course program at $79 per course, I needed to make sure I did some coding while I waited for my next CS class to come along.  I liked that it was project based. I had to turn in something each and every week along with reviewing the code of 3 or more other students in the course with me.  I took the HTML, CSS and JavaScript course first. It was interesting. I  made a few simple projects and even learned a few things. The most recent class was Front-End Web UI Frameworks and Tools. Before this class, I’d never used Bootstrap! Where has it been all my life. I’ve heard the term used and I never ‘got it’! I am truly a convert. What a quick and easy way to get a site up and running FAST & RESPONSIVE!

HTML, CSS and JavaScript Certificate

Front-End Web UI Frameworks and Tools Certificate

I’m taking a week off to decompress. The next course is Front-End JavaScript Frameworks: AngularJS.  Let’s see what unfolds.

During the week off, I’ll be clicking around JavaScript30, knocking out some of those projects, or at the very least, looking at some really cool code. Also, checking out this course on Udemy, JavaScript: Understanding the Weird Parts.  Yeah, right.. week off!

*Update*

I found out the course I really wanted to take next semester isn’t available. I just signed up for a class at the local community college to take Java I.  I’m considering getting my Masters in Computer Science, but since I was a business major, I have quite a few prerequisites to make up.

  • 1 year of Java
  • 1 year of Calculus
  • Data Structures
  • and many more

Classes I need to take before the Masters in Computer Science

I’ll putz around the next year or so and decide what’s next. In the meantime, I have so much learning to do. Let’s see what unfolds.

Here are some links we covered in UX

 

 

Deciding how to bone up on JavaScript before next semester

I’m going to start by saying, there are not enough hours in a day to do EVERYTHING I love to do. That being said, I have to carve out time to bone up on JavaScript ahead of the next class in the Web Design Professional Certificate program I’m enrolled in. I know my skill set is woefully lacking in JavaScript and addressing it now is my goal, ahead of classes starting in the fall.

If I lived in San Francisco, I’m sure I’d be taking the coding bootcamp at HackReactor, pretty darn sure! As I’m reading their blog, I came upon a post about preparing for their code challenge during the first part of their admissions process.

You’ll want to know what an object, function, and array are, and you should be able to create a basic version of each one. CodeAcademy and many other sites provide sandboxes to write code and see what it does.

Now here is something I can sink your teeth into and use as hard metrics in determining if I’m ready for JavaScript. As luck would have it, I’m making my way through the JavaScript Track on CodeAcademy and I just picked up the Eloquent JavaScript book mentioned in the post.

Finishing the JavaScript track on CodeAcademy (25% complete), along with taking the JS 101: JavaScript for Beginners class with Girl Develop It and getting a few PluralSight and Lynda.com videos in this summer may be just what I need to learn more about it.

Lynda.com Online Courses

Learning Tracks at Lynda.com