Posts

Showing posts with the label Mongo

Graduated!

Image
It's official. As of Friday, September the 15th I am an Iron Yard alumni! The next four weeks entail a final project. I will be working closely with a classmate on a project of our choosing. Fortunately for us I already had an idea in mind. Since November of last year I have been a volunteer at the LGBT Center of Raleigh. With my new development skills I proposed helping maintain the site to the web team, Jim Manchester. He came back with the suggestion to do a full page redesign! This is a huge undertaking and one I intend to pour my heart and soul into so the main viable product I can deliver by the end of the four weeks is a high fidelity prototype of the home page. That is just a fancy term for a coded mockup. My project partner Kelly from DesignBright will be in charge of technical writing, SWOT analysis, and market research. As well, she will be a developer and lead designer for the project. We intend to update the LGBT Center's webpage to modern standards, introduce ...

Code Snippets: Storing Data with Mongo

Image
Now that I have schemas in my models folder for both users and snippets I'm going to need a way to store them. I could use a SQL database which would store the snippets in the user table with a foreign key or a NoSQL database which is a bit more flexible. Even though SQL is the better choice, I am more familiar with Mongoose then Sequelize (both are the middleware used to help Node talk to the database).  For now, I will use Mongo and Mongoose to store the data from my application. Since I put each of those schemas in their own file I was able to export them. Once they were exported, I could require them in my main file along with the routes I created for each of my pages. I made a route for the login, the register page, the home page, and a place to render the results of a search. All of these are referenced in my app.js - the index of my project. In that same file is where I declare a url for Mongoose. Mongoose needs a connection between my application and the database inside o...

Code Snippets: Password Encryption

Image
Another model I need to use for this web application is for my user's. When someone visits my app I want to ask for username, name, and email. At some point, they should be able to edit their profile to add a picture or an avatar and I definitely want to encrypt their passwords for them. In order to make sure each user has these elements attached to their profile I created a schema, installed a package to handle my encryption, and a package to handle authenticating that password. I chose bcrypt and Password because that is what I'm familiar with and what we went over in class. However, there are other ways to encrypt passwords and other packages that do it similarly. The userSchema.methods and .statics was all 'boilerplate' code that I was able find in our reading material but if I ever need it again in the future I can either look back on this project or find bcrypt documentation. My next steps will be routing my login and register pages that I made templates fo...

Code Snippets

Image
I have no idea if this is the best approach to a project but I'm implementing the MVC methodology to this web app that I'm building. As in, I'm first going to build as much of the model as I can then as much of the views as I can before working on the controller. As I mentioned yesterday, what I do know is that I will need two schemas for this project - one for the snippets and one for the users. I will be using a noSQL database because I already know how to use Mongoose to connect Mongo to my Node application. One trick I knew I would have to add in order to 'link' the two collections in my database is on line 15. I knew I would have to give each snippet a way to connect to its owner in order to only display that owner's snippets. This probably would have been easier to do in a SQL database where tables have a bit more structure and can include foreign keys to reference other tables. However, I wanted to use tools I have already learned how to use to accom...

Creating a Back End Application

Image
To wrap up our back end instruction The Iron Yard requires a final project that rounds out the skills we've learned over the last three weeks. In a nutshell, we use Node.js and a few of its packages to write an application. Our objective is to create a web app that requires a login and password, allows for registration, enforces password encryption, and brings the user to a home page. For this project, that home page is a code snippet organizer. This project has no mockup or wireframe because design is not the main objective. However, there are a set of abilities our app must have. A user must be able to view all of their snippets, be able to edit or add or delete their snippets, and there must be a search bar that filters through those snippet's tags and languages. That means there are two schemas being used in conjunction. There is a collection of users and a collection of snippets all being stored in the same database. They have to be two separate schemas because each mode...

Salt Your Hash!

Image
Security is a huge topic in tech. As technology progresses so does cyber security. I know basically nothing about it either! However, we did learn about encrypting passwords yesterday and tried our hand at two different ways to do so. One package is bcrypt and another is Password. I played around with each and the biggest difference is that Password allows for logging in through twitter or facebook. Pretty neat, right? I didn't get the chance to play around with it that much though. I did local encryption instead. This all still looks foreign to me but a great benefit of Node.js is the ability to use these packages when you need them with the code you already have. As I get more comfortable with the language I'll be able to create a multi-page application with authentication, validation, and password encryption!

A Mongo and A Mongoose

Image
Last week we covered databases! Super exciting, right? It only makes sense, though, that the majority of back end development would be storing, accessing, and updating data. There are quite a few tools available for Node.js and the ones we covered are Mongo and Mongoose. Mongo or MongoDB itself stores data flexibly. Why does that flexibility matter? It is perfect for sets of data that are incomplete. If I had a list of contacts I wanted to store but I didn't have everyone's emails it wouldn't be a big deal - those email addresses would just be empty. Mongo stores the data and Mongoose is a tool that accesses it for you. This is the secure way to retrieve data and validate it rather than having potentially sensitive information stored right in the code for anyone to see. Mongoose is pretty straightforward to use and I implemented it into my robots database (that thing again!). In a nutshell, I was able to swap out the database I had stored in a file and put it into Mongo o...