-
Notifications
You must be signed in to change notification settings - Fork 340
Image Search Abstraction Layer
Created by Rafase282
Github | FreeCodeCamp | CodePen | LinkedIn | Medium Website | E-Mail
Build a full stack JavaScript app that successfully reverse-engineers this: https://shurli.herokuapp.com/ and deploy it to Heroku.
Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit https://cryptic-ridge-9197.herokuapp.com/api/imagesearch/lolcats%20funny?offset=10 and browse recent search queries like this: https://cryptic-ridge-9197.herokuapp.com/api/latest/imagesearch/. Then deploy it to Heroku.
As you build your app, you should frequently commit changes to your codebase. You can do this by running git commit -am "your commit message"
. Note that you should replace "your commit message" with a brief summary of the changes you made to your code.
You can push these new commits to GitHub by running git push origin master
, and to Heroku by running grunt --force && grunt buildcontrol:heroku
.
- I can get the image URLs, alt text and page urls for a set of images relating to a given search string.
- I can paginate through the responses by adding a ?offset=2 parameter to the URL.
- I can get a list of the most recently submitted search strings.
While heroku can use them as is, cloud9 needs extra work to get them from the .env
file that you would create.
The Bing search api is a pain. I recommend using a npm package to handle it, there are many and I listed one of them. You will also have to sign up to get a key which I recommend using from the .env
file as to not leak your key. It has a main key but it is better to create a new one that you can delete if it gets compromised, because the main one can't be changed.
Learning about Mongoose was fun. Basically you have to require it, create a scheme, turn it into a model and then youc an use it to create documents.
1- Require Mongoose and declare Schema.
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
2- Create Schema
var kittySchema = mongoose.Schema({
name: String
});
3- Turn the schema into a model, and connect to it.
var Kitten = mongoose.model('Kitten', kittySchema);
var mongouri = process.env.MONGOLAB_URI || "mongodb://" + process.env.IP + ":27017/img-sal";
mongoose.connect(mongouri);
While you can do 1 to 3 on the server like I did, the step for and any other can be done anywhere else as long as you know how to export the model.
4- Create new documents based on the model
var silence = new Kitten({ name: 'Silence' });
console.log(silence.name); // 'Silence'
How to export the model to my api.
api(app, Kitten);
then on the api file: module.exports = function(app, History) {
The search and find can be found on the documentation along with the rest of teh steps I have listed aside from exporting.
Thanks for visiting, if you like this please feel free to star my repo, follow me or even contact me about contributing as it will be a lot of work and having help would be cool.
- HTML5 and CSS
- Responsive Design with Bootstrap
- Gear up for Success
- jQuery
- Basic JavaScript
- Object Oriented and Functional Programming
- Basic Algorithm Scripting
- Basic Front End Development Projects
- Intermediate Algorithm Scripting
- JSON APIs and Ajax
- Intermediate Front End Development Projects
- Claim Your Front End Development Certificate
- Upper Intermediate Algorithm Scripting
- Automated Testing and Debugging
- Advanced Algorithm Scripting
- AngularJS (Legacy Material)
- Git
- Node.js and Express.js
- MongoDB
- API Projects
- Dynamic Web Applications
- Claim Your Back End Development Certificate
- Greefield Nonprofit Project 1
- Greefield Nonprofit Project 2
- Legacy Nonprofit Project 1
- Legacy Nonprofit Project 2
- Claim your Full Stack Development Certification
- Whiteboard Coding Interview Training
- Critical Thinking Interview Training
- Mock Interview 1
- Mock Interview 2
- Mock Interview 3