Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
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
16 changes: 16 additions & 0 deletions controllers/apiController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function index(req, res) {
res.json({
message: "Welcome to Skatespot.com!",
// documentation_url: "https://github.com/sf-wdi-labs/tunely",
// base_url: "localhost:3000",
endpoints: [
{
method: "GET", path: "/api", description: "Describes available endpoints"
}
]
});
}

module.exports = {
index: index
}
4 changes: 4 additions & 0 deletions controllers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
api: require('./apiController'),
albums: require('./skatespotController'),
}
55 changes: 55 additions & 0 deletions controllers/skatespotController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/************
* DATABASE *
************/

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

// // GET /api/skatespots
Copy link

Choose a reason for hiding this comment

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

It seems like this code is mostly-working, but all commented out--I'm confused by the state this code was left in.

// function index(req, res) {
// db.Skatespot.find({}, function(err, allSpots){
// res.json(allSpots);
// });
// }
//
// // POST /api/skatespots
// function create(req, res) {
// console.log('body', req.body);
// var attributes = req.body.attributes.split(',').map(function(item){
// return item.trim();})
// req.body.attributes = attributes;
// db.Skatespot.create(req.body, function(err,skatespot){
// if(err) {console.log('error',err);}
// console.log(skatespot);
// res.json(skatespot);
// })
// }
//
// // GET /api/skatespots/:skatespotId
// function show(req, res) {
// db.Skatespot.findById(req.params.skatespotId, function(err, foundSkatespot) {
// if(err) { console.log('skatespotController.show error', err); }
// console.log('skatespotController.show responding with', foundSkatespot);
// res.json(foundSkatespot);
// });
// }

// DELETE /api/skatespots/:skatespotsId
function destroy(req, res) {


}

// PUT or PATCH /api/skatespots/:skatespotsId
function update(req, res) {

}


// export public methods here
module.exports = {
index: index,
create: create,
show: show,
destroy: destroy,
update: update
};
10 changes: 0 additions & 10 deletions models/campsite.js.example

This file was deleted.

2 changes: 1 addition & 1 deletion models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ 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.Campsite = require("./campsite.js.example");
module.exports.Skatespot = require("./skatespot.js");
14 changes: 14 additions & 0 deletions models/skatepark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var mongoose = require('mongoose'),
Schema = mongoose.Schema;

var SkatespotSchema = new Schema({
spotName: String,
address: String,
generalDirections: String,
attributes: [String],
// img:
});

var Skatespot = mongoose.model('Skatespot', SkatespotSchema);

module.exports = Skatespot;
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
"homepage": "https://github.com/SF-WDI-LABS/express-personal-api",
"dependencies": {
"body-parser": "^1.15.0",
"bower": "^1.8.0",
"express": "^4.13.4",
"mongoose": "^4.4.10"
"express-session": "^1.15.5",
"method-override": "^2.3.9",
"mongoose": "^4.4.10",
"nodemon": "^1.11.0"
}
}
28 changes: 22 additions & 6 deletions public/styles/styles.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
body {
color: #333;
font-family: Helvetica, Arial, sans-serif;
background-color: skyblue; /* Sanity Check! */
.jumbotron {
background-image: url(http://www.revolution.co.za/wp-content/uploads/2015/02/Screen-shot-2015-02-13-at-10.41.00-AM.jpg);
background-size: cover;
background-repeat: no-repeat;
color: #EEE;
}
.jumbotron .container {
height: 450px;
}

h1 {
margin-top: 100px;
.inline-header {
display: center;
vertical-align: baseline;
margin-right: 12px;
}
legend {
text: bold;
}
.footer{
background-color: black;
margin-top: 20px;
padding-top: 20px;
min-height: 200px;
text-align: center;
color: white;
}
18 changes: 9 additions & 9 deletions seed.js
Original file line number Diff line number Diff line change
@@ -1,15 +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 db = require('./models');

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

Choose a reason for hiding this comment

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

It seems like you didn't actually edit your seed file to be relevant to the structure of your skatespots.


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

// console.log("Created new campsite", campsite._id)
// process.exit(); // we're all done! Exit the program.
// })
console.log("Created new skatepark", skatepark._id)
process.exit(); // we're all done! Exit the program.
})
8 changes: 4 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ app.use(function(req, res, next) {
* DATABASE *
************/

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

/**********
* ROUTES *
Expand Down Expand Up @@ -49,12 +49,12 @@ app.get('/api', function apiIndex(req, res) {
res.json({
woopsIForgotToDocumentAllMyEndpoints: true, // CHANGE ME ;)
Copy link

Choose a reason for hiding this comment

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

Since you have updated all the below lines, you can change this flag to false. Or probably delete the whole line altogether so it does not show up.

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
documentationUrl: "https://github.com/deathofasellout/express-personal-api/README.md", // CHANGE ME
baseUrl: "https://immense-cove-18493.herokuapp.com/", // CHANGE ME
endpoints: [
{method: "GET", path: "/api", description: "Describes all available endpoints"},
{method: "GET", path: "/api/profile", description: "Data about me"}, // CHANGE ME
{method: "POST", path: "/api/campsites", description: "E.g. Create a new campsite"} // CHANGE ME
{method: "POST", path: "/api/skateparks", description: "E.g. Create a new skatepark"} // CHANGE ME
]
})
});
Expand Down
70 changes: 64 additions & 6 deletions views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,76 @@

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

<!-- APPLICATION SCRIPTS -->
<script src="/scripts/app.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1>Under Construction</h1>
<h4><a href="/api">Read My API Documentation</a></h4>
</div>
<body>
<div class="jumbotron">
<div class="container">
<h1>Skatespot.com</h1>
<p>Find a Skatespot!</p>
</div>
</div>

<!-- Begin form Section -->
<section id="skatepark-form" class="container">
<!-- a row can be any size in height, grows bootstrap -->
<div class="row"> <!-- a row just sets up the containters -->
<!-- offset is spacing, offest by one leaves the 1st container empty
and starts the div one over from the left, since there are 10
it centers it, leaving one column empty on both sides -->
Copy link

Choose a reason for hiding this comment

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

These comments are awesome!

<div class="col-lg-10 col-lg-offset-1">
Copy link

Choose a reason for hiding this comment

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

I'm concerned that you're using col-lg in some places, and col-md in others--you generally want to use the smallest possible size for everything, so make all of them col-md or col-sm.

<form class="info-form"> <!--allows you to capture info from a form-->
<!-- Form Name -->
<legend>Add A Skatespot</legend> <!--legend gives semantic meaning-->
<!-- Text input-->
<div class="form-group"><!--entering col-lg-6 makes it offcenter -->
<label class="col-md-6 control-label" for="spotName">Enter a
name:</label>
<div class="col-md-6">
<input id="spotName" name="spotName" type="text" placeholder="" class="form-control input-lg" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-6 control-label" for="address">Address:</label>
<div class="col-md-6">
<input id="address" name="address" type="text" placeholder="" class="form-control input-lg">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-6 control-label" for="generalDirections">General Directions from the address:</label>
<div class="col-md-6">
<input id="generalDirections" name="generalDirections" type="text" placeholder="" class="form-control input-lg">
</div>
</div>
<!-- Textarea -->
<div class="form-group">
<label class="col-md-6 control-label" for="attributes">What does this spot have?</label>
<div class="col-md-6">
<textarea class="form-control" id="attributes" name="attributes">Ledges, Rails, Vert</textarea>
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-6 control-label" for="singlebutton">Save This Spot!</label>
<div class="col-md-6">
<button id="saveButton" name="saveButton" class="btn btn-primary">Save it, bruh!</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</section>
<div class="footer">
<h3>Connect with other people, share your spots, and have an amazing session.</h3>
</div>
</div>
</body>
</html>
<!-- 1.Skate spot name. 2.Address. 3.General Directions from address. 4.What the spot has to offer. 5.Images. -->