Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix syntax highlighting and some formatting #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

Most programming languages have libraries or modules that allow your program to dynamically interact with information stored in a database. With our end-goal in mind we are going to use the *Node.js* framework. The reason we are using Node.js is because a lot of infrastructure on the web is built around JavaScript. The node website explains itself well:

```
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses

>Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses
an event-driven, non-blocking I/O model that makes it lightweight and efficient.

Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries
>Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries
in the world.
```

Node.js (along with various packages) will allows us to
* Create code that changes the contents of your database
Expand Down Expand Up @@ -77,7 +76,7 @@ node showDatabases.js

First the **credentials.json** file:

```{json}
```json
{
"user" : "testy_pete",
"password" : "not really my password"
Expand All @@ -86,7 +85,7 @@ First the **credentials.json** file:

And now for all the magic in **showDatabases.js**:

```{js}
```js
var credentials = require('./credentials.json');

var mysql=require("mysql");
Expand All @@ -107,8 +106,9 @@ connection.query('SHOW DATABASES',function(err,rows,fields){
console.log('Error looking up databases');
} else {
console.log('Returned values were ',rows);
}
}
});

connection.end()
console.log("All done now.");
```
Expand Down Expand Up @@ -143,7 +143,7 @@ If you see alot of databases then you did not properly restrict your accounts `G
If you pay close attention to the output you might notice something a bit odd: The output *All done now.* appears before everything else. What's up with that?

Let me simplify the code a bit:
```{js}
```js
connection=<setup>;
connection.connect(function(err){...});
connection.query('SHOW DATABASES',function(err,rows,fields){...});
Expand Down