Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added Archive/.DS_Store
Binary file not shown.
Binary file added Archive/01 - GET request/.DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions Archive/01 - GET request/models/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var mongoose = require("mongoose");
mongoose.connect( process.env.MONGODB_URI || "mongodb://localhost/personal-api", {useMongoClient: true});
mongoose.Promise = global.Promise; // use native Promise

module.exports.Venue = require("./venue.js");
14 changes: 14 additions & 0 deletions Archive/01 - GET request/models/venue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var mongoose = require('mongoose'),
Schema = mongoose.Schema;

var VenueSchema = new Schema({
name: String,
location: String,
website: String,
image: String,
notes: String,
});

var Venue = mongoose.model('Venue', VenueSchema);

module.exports = Venue;
Empty file.
32 changes: 32 additions & 0 deletions Archive/01 - GET request/public/scripts/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
console.log("Sanity Check: JS is working!");

$(document).ready(function(){

// your code
//Create a variable to shorthand for the delete button section in the index.html
$venueList = $("#bookTarget");
//This will pull the api information from the below path
$.ajax({
url: '/api',
success: handleSuccess,
error: handleError
});

//Create a new form on the submit button
//Create a submit button in the index.html
$('#newVenueForm').on('submit', function(event) {
//Prevent the button from submitting AKA refreshing the page
event.preventDefault();
//POST the new information to the path below and will turn it into a string using serialize
$.ajax({
method: 'POST',
url: '/api',
data: $(this).serialize(),
success: newVenueSuccess,
error: newVenueError
});
});



});
20 changes: 20 additions & 0 deletions Archive/01 - GET request/public/styles/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
body {
color: #fafafa;
font-family: Helvetica, Arial, sans-serif;
background-color: #181818;
background-repeat: no-repeat;
background-size: cover;
}

h1 {
margin-top: 100px;
text-align: center;
color: white;
}
h2 {
color: #75b0d4;
}

h3 {
color: #75b0d4;
}
15 changes: 15 additions & 0 deletions Archive/01 - GET request/seed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This file allows us to seed our application with data
// simply run: `node seed.js` from the root of this project folder.

// var db = require('./models');

// var new_campsite = {description: "Sharp rocks. Middle of nowhere."}

// db.Campsite.create(new_campsite, function(err, campsite){
// if (err){
// return console.log("Error:", err);
// }

// console.log("Created new campsite", campsite._id)
// process.exit(); // we're all done! Exit the program.
// })
127 changes: 127 additions & 0 deletions Archive/01 - GET request/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// require express and other modules
var express = require('express'),
app = express();


// parse incoming urlencoded form data
// and populate the req.body object
var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: true }));

// allow cross origin requests (optional)
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});

/************
* DATABASE *
************/

var db = require('./models');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You set up the variable "db" but you never use it...


/**********
* ROUTES *
**********/

// Serve static files from the `/public` directory:
// i.e. `/images`, `/scripts`, `/styles`
app.use(express.static('public'));

/*
* HTML Endpoints
*/

app.get('/', function homepage(req, res) {
res.sendFile(__dirname + '/views/index.html');
});


/*
* JSON API Endpoints
*/
app.get('/api/profile', function apiIndex(req,res) {
res.json({
endpoints: [{
name: "Carlynn Espinoza",
githubUsername: "Carlynn",
githubLink: "https://github.com/Carlynn",
githubProfileImage: "https://avatars1.githubusercontent.com/u/29782639?v=4&s=460",
personalSiteLink: "https://carlynn.github.io/",
currentCity: "San Francisco",
hobbies: [
{
optionOne: "Answer A",
optionTwo: "Answer B",
},
{
optionThree: "Answer C",
optionFour: "Answer D",
},
]
}]
});
});

app.get('/api', function apiIndex(req, res) {
res.json({
endpoints: [
{
name: "Oxford Social Club",
location: "San Diego",
website: "https://theoxfordsd.com/",
image: "https://pbs.twimg.com/profile_images/745999186265399296/AgQFU1QA.jpg",
notes: "Be Sophisticated or Don't",
},
{
name: "The Bungalow",
location: "Santa Monica",
website: "http://www.thebungalow.com/",
image: "https://s3-media1.fl.yelpcdn.com/bphoto/F-f7YjOFDd9b5jKVmkE84Q/ls.jpg",
notes: "Breezy, beachside Baja lifestyle",
},
{
name: "The Battery",
location: "San Francisco",
website: "https://www.thebatterysf.com/club/",
image: "https://qph.ec.quoracdn.net/main-thumb-t-453945-200-wcuvopxyeusrfhqagrthqdwyvviwbgol.jpeg",
notes: "Diversity and intelligence with just a touch of the bizarre",
},
]
})
});


router.get("/", require("./controllers/index"));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much commented out code!! We let it slide the first couple projects but we're going to get nit-pickier about these things moving forward. You should make sure that you're not leaving in console.logs or commented out code.

// router.post("/", require("./controllers/create"));
// router.put("/:id", require("./controllers/update"));
// router.get("/:id/edit", require("./controllers/edit"));
// app.delete("/:id", require("./controllers/destroy"));

// app.get('/api', function apiIndex(req, res) {
// // TODO: Document all your api endpoints below as a simple hardcoded JSON object.
// // It would be seriously overkill to save any of this to your database.
// // But you should change almost every line of this response.
// res.json({
// woopsIForgotToDocumentAllMyEndpoints: true, // CHANGE ME ;)
// message: "Welcome to my personal api! Here's what you need to know!",
// documentationUrl: "https://github.com/example-username/express-personal-api/README.md", // CHANGE ME
// baseUrl: "http://YOUR-APP-NAME.herokuapp.com", // CHANGE ME
// endpoints: [
// {method: "GET", path: "/api", description: "Describes all available endpoints"},
// {method: "GET", path: "/api/profile", description: "pizza"}, // CHANGE ME
// {method: "POST", path: "/api/campsites", description: "E.g. Create a new campsite"} // CHANGE ME
// ]
// })
// });

/**********
* SERVER *
**********/

// listen on the port that Heroku prescribes (process.env.PORT) OR port 3000
app.listen(process.env.PORT || 3000, function () {
console.log('Express server is up and running on http://localhost:3000/');
});
91 changes: 91 additions & 0 deletions Archive/01 - GET request/views/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Bad and Boujee</title>

<!-- STYLESHEETS -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="/styles/styles.css">

<!-- VENDOR SCRIPTS -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>

<!-- APPLICATION SCRIPTS -->
<script src="/scripts/app.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-offset-1" style="border: orange solid 2px">
<h1>BAD and BOUJEE</h1>
<h3>Venues</h3>
<h2>Venues</h2>

<!--One Venue-->
<!-- Wrap the entire html for one venue within a form. This will be called back in the app.js -->
<form class="form-inline" id="newVenueForm">
<div class="row margin-top-20 wine-container" style="border: blue solid 2px">
<div class="col-sm-3">
<img src="http://www.modern-traveler.com/wp-content/uploads/2017/02/Oxford-Social-Club.jpg" class="img-responsive" />
</div>
<div class="col-sm-9" style="border: pink solid 2px">
<div class="margin-top-20">
<span><b>Name: </b></span><span>TestName</span>
</div>
<div>
<span><b>Location: </b></span><span>TestLocation</span>
</div>
<div>
<span><b>Website: </b></span><span>TestWebsite</span>
</div>
<div>
<span><b>Image: </b></span><span>TestImage</span>
</div>
<div>
<span><b>Notes: </b></span><span>TestNotes</span>
</div>
<div class="margin-top-10">
</div>
<div class="margin-top-20">
<a class="btn btn-default">Edit Notes</a>
</div>
</form>
<!-- app.js will target this to create a delete button -->
<div id="bookTarget"></div>
</div>
</div>
<!--/One Wine-->
<div class="footer">
<h3>About the Author</h3>
<div class="col-sm-2">
<img src="https://avatars1.githubusercontent.com/u/29782639?v=4&s=460" class="img-responsive" style="width: 100px"/>
</div>
<div class="col-sm-10" style="border: pink solid 2px">
<div class="margin-top-20">
<div>
<span><b>Name: </b></span><span>myName</span>
</div>
<div>
<span><b>Github Link: </b></span><span>TestLocation</span>
</div>
<div>
<span><b>Personal Site Link: </b></span><span>TestLocation</span>
</div>
<div>
<span><b>Current City: </b></span><span>TestLocation</span>
</div>
<div>
<span><b>Hobbies: </b></span><span>TestLocation</span>
</div>
<div>
<span><b>Location: </b></span><span>TestLocation</span>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Loading