Giter VIP home page Giter VIP logo

clementinejs's People

Contributors

dting avatar gitter-badger avatar johnstonbl01 avatar therebelrobot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clementinejs's Issues

Typo #2 in Refactoring Routes section

Add comma between "Hello" and "world!" (placed in bold below) in second to last sentence of this section (http://www.clementinejs.com/tutorials/tutorial-beginner.html#RefactoringRoutes)

"Point the browser to localhost:3000 and you should again see "Hello**,** world!""

EDIT: another solution would be to fix the index.html section of this tutorial so that the user types in:

<body>
        <p>Hello world!</p>
</body>

(without comma) instead of

<body>
        <p>Hello, world!</p>
</body>

Show where in the server.js file to place code snippet

In Adding Additional Elements to Index.html section (http://www.clementinejs.com/tutorials/tutorial-beginner.html#AddingAdditionalElementstoIndex.html):

You do not specify where in the server.js file to place the following line of code:
app.use('/public', express.static(process.cwd() + '/public'));

This is very important. I would suggest adopting the way the https://www.railstutorial.org/book does it by showing parts of the file with ... for the parts that already exist. Example:


This can be solved by adding app.use('/public', express.static(process.cwd() + '/public')); to the server.js file as shown below:

server.js

'use strict';
.
.
.
routes(app);

app.use('/public', express.static(process.cwd() + '/public'));

app.listen(8080, function() {...
.
.
.

Code typos/omissions - Setting Up the Server-Side Controller section

First code block in Setting Up the Server-Side Controller section (http://www.clementinejs.com/tutorials/tutorial-beginner.html#SettingUptheServer-SideController) has the following line of code that is not indented according to the code guidelines:
thow err;

It is also missing a semicolon after the closing parenthesis of clicks.findOne({}, clickProjection... ) and an unnecessary semicolon after the closing curly bracket of function clickHandler (db) { ... }

The last bullet in the unordered list that explains each line of code (res.json(results); - Send a response to the browser with a JSON version of the results array.) is using results(plural) in two places instead of what's actually in the code which is result (singular). Change that bullet to read as follows: res.json(result); - Send a response to the browser with a JSON version of the result array.

TypeError: db.collection is not a function

Thank you for this boilerplate and the tutorial, it helped me understand how the back-end works and how it tied together.

I'm following the Clementine.js Beginner Tutorial, and I got an error in the Setting Up the Server-Side Controller section.

TypeError: db.collection is not a function

I found out that the tutorial expects to install MongoDB version 2, but I just installed the version 3.

"dependencies": {
  "express": "^4.16.3",
  "mongodb": "^3.1.0-beta4"
}

I found this StackOverflow answer and this changes between version 2 and version 3 to fix the error using the version 3 of MongoDB.

Here's my updated server.js with MongoDB version 3 installed:

'use strict';

var express = require('express');
var routes = require('./app/routes/index.js');
var mongo = require('mongodb').MongoClient;

var app = express();

mongo.connect('mongodb://localhost:27017/clementinejs', function (err, client) {
  if (err) {
    throw new Error('Database failed to connect!');
  } else {
    console.log('MongoDB successfully connected on port 27017.');
  }

  var db = client.db('clementinejs');

  app.use('/public', express.static(process.cwd() + '/public'));
  app.use('/controllers', express.static(process.cwd() + '/app/controllers'));

  routes(app, db);

  app.listen(3000, function () {
    console.log('Listening on port 3000...');
  });
});

I hope it helps. Let me know if you want to upgrade to version 3 of MongoDB I would like to send a pull request for this.

Typo sendFile should be sendfile

In the Refactoring Routes section the command res.sendFile(process.cwd() + '/index.html'); should not have the F in caps. Instead should be res.sendfile(process.cwd() + '/index.html');

Typo in Refactoring Routes section

Typo. Fix in bold:

"This is an alternative to app.get, and let's us bundle together several types of routes for a single page request (this will become apparently apparent later in the tutorial). "

Error with sendFile on c9.io

I was given an error that sendFile was not a function when trying to serve the first file. Strangely, even though I am using the newest Express version, the deprecated sendfile works. Also I was able to use express's static function which worked fine as well: app.use('/', express.static(__dirname));. I'm not sure if this is a local issue or not.

Database Fails To Connect?

Dear John,

I already expressed my thanks and admiration on Twitter but I reiterate: this boilerplate and tutorial you have created is one of the best resources I have encountered in my short journey to become a developer.

I am following the basic tutorial and I have hit a roadblock. I got to the step where I connect the front end to the database but, even after triple checking that I have exactly the same code in my files (and after that, directly pasting your code for server.js) I get the following error as the err in the mongo.connect callback function:
[MongoError: failed to connect to server [localhost:27017] on first connect]

I have double checked that I have MongoDB installed.

For reference, here is the current state of my boilerplate is found here.

I will keep trying to solve it on my own but I thought it would be nice for you and maybe others to know.

Happy 2017!

Consider mentioning scenario where .gitignore is not present

When I reached the .gitignore section in your tutorial (http://www.clementinejs.com/tutorials/tutorial-beginner.html) I looked in my directory and could not find a .gitignore file in my root directory (even with hidden files shown). While it may seem obvious to experienced coders, you may want to mention the fact that if the user does not have such a file, that they can create one but sending touch .gitignore and then opening the file using nano .gitignore to add the node_modules/.

By adding this text, you let the user know that just because they don't have this .gitignore file does not mean they did something wrong in the previous steps (which is what I assume a lot of times when I am going through a tutorial and what I see does not match what the tutorial mentions).

FCC corrupted database

I have a corrupted database (mongodb) using the clementinejs. I need to know how to reset it or how to pull this database out of the "node_modules" folder. I see this becoming a huge problem for future FCC peps. when I do a git from the server with last known good configuration I still have a corrupted db. I think this is because of the ".gitignore" file.

Responsive Design and Hover State

I think it would be useful to add a small amount of CSS to produce a mobile version of the UI and a hover state for the buttons. I have have written this script and will open a pull request. The attached files are before-after screenshots of the mobile UI.

before

after

Typo/Grammar errors in CreateControllerFunctions section

Second bullet in the second unordered list of CreateControllerFunctions (http://www.clementinejs.com/tutorials/tutorial-beginner.html#CreateControllerFunctions) section:
-The url that the function make makes the HTTP request to

Two paragraphs after the unordered list mentioned above:
"xmlhttp.onreadystatechange = function () { ... }: Here we are assigning a callback funciton function to the property onreadystatechange."

Further down, the sentence right before the clickController.client.js code block:
"Next, let's write a small function that will update the HTML <span element."
and again further down:
"Next, we'll take the clickNbr element (which we defined by using var clickNbr earlier) and use the .innerHTML property to define the contents of the <span element and set it equal to the clicks property of our newly-created JSON object."

Deprecated feature in Mongoose

Server.js section in Clementine.js Passport Authentication Tutorial

the directions if followed gives me a deprecation warning if using following code. mongoose.connect('mongodb://localhost:27017/clementinejs');

changing code to following solves this issue.
mongoose.connect('mongodb://localhost:27017/clementinejs', {useMongooseClient: true});

Using JQuery in Client side controller (clickController.client.js)

I started following tutorials for clementinejs through official tutorial and when i got to part where you define methods related to loading files after dom is loaded and making ajax requests, i was a little too overwhelmed because i never had to deal with that before and i always took help from jquery.

So, i completed the tutorial but using jquery instead and i thought if anybody else would like to do so too.

Passport Tutorial: Defining query variable in clickHandler.server.js

var query = { 'github.id': req.user.github.id }; This is in the tutorial for clickHandler.

This doesn't work because req is undefined at this point (I think).

I looked at the source code and looks like you just put the query in each of the functions i.e.

.findOne({ 'github.id': req.user.github.id }, { '_id': false })

Clementine logo image link

In the beginner tutorial section (http://www.clementinejs.com/tutorials/tutorial-beginner.html#AddingAdditionalElementstoIndex.html):

There is a link to the Clementine logo so the user can download it and place it in their img folder. This link leads here: https://github.com/johnstonbl01/clementinejs-angular/blob/master/public/img/clementine_150.png. If you try to curl this url, it gives you a bogus image.

Suggestion: have the link in the document point here: https://raw.githubusercontent.com/johnstonbl01/clementinejs-angular/master/public/img/clementine_150.png which is the actual location of the image file so that the user can then curl it.

Have user stop the node server.js app and tell them how

Location of issue
Somewhere in this section:
http://www.clementinejs.com/tutorials/tutorial-beginner.html#SimpleNodeServer

Issue
Tutorial does not explicitly instruct user to stop the running app you had them start using $ node server.js even though later on in this section you instruct them to start the app up again.

Suggested Solution
I suggest adding a line or two in between the two "hello world" runs explicitly tell user to stop the app and show them how (Ctrl+C).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.