mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 18:32:50 +00:00
minor fixes
This commit is contained in:
@@ -31,10 +31,10 @@ router.post('/', function(req, res,next) {
|
|||||||
var invalid = {};
|
var invalid = {};
|
||||||
var validInputs = true;
|
var validInputs = true;
|
||||||
|
|
||||||
hours = ("0" + hours).slice(-2);
|
|
||||||
minutes = ("0" + minutes).slice(-2);
|
|
||||||
|
|
||||||
var time = hours + ":" + minutes + ampm;
|
var time = hours + ":" + minutes + ampm;
|
||||||
|
console.log("--time: " + time);
|
||||||
|
|
||||||
if(!numberValidator(number)){
|
if(!numberValidator(number)){
|
||||||
invalid.number = 'Invalid Number';
|
invalid.number = 'Invalid Number';
|
||||||
@@ -141,6 +141,6 @@ function dateValidator(date){
|
|||||||
|
|
||||||
function timeValidator(time){
|
function timeValidator(time){
|
||||||
//var re = /^\d{1,2}\:\d{2}am$|^\d{1,2}\:\d{2}pm$/;
|
//var re = /^\d{1,2}\:\d{2}am$|^\d{1,2}\:\d{2}pm$/;
|
||||||
var re = /^[0-9]\:[0-5][0-9]am$|^[0-9]\:[0-5][0-9]pm$|^1[0-2]\:[0-5][0-9]am$|^1[0-2]\:[0-5][0-9]pm$/;
|
var re = /^[0-9]\:[0-5][0-9]AM$|^[0-9]\:[0-5][0-9]PM$|^1[0-2]\:[0-5][0-9]AM$|^1[0-2]\:[0-5][0-9]PM$/;
|
||||||
return re.test(time);
|
return re.test(time);
|
||||||
}
|
}
|
||||||
@@ -1,53 +1,53 @@
|
|||||||
div.blog-post
|
div.blog-post
|
||||||
h2.blog-post-title First Blog Post
|
h2.blog-post-title First Blog Post
|
||||||
p.blog-post-meta July 21st 2015 by Mitchell
|
p.blog-post-meta July 21st 2015 by Mitchell
|
||||||
p.
|
p
|
||||||
My first blog post introduces this website and the motives behind it.
|
|My first blog post introduces this website and the motives behind it.
|
||||||
I discuss setting up a Node.js webserver for the first time and
|
|I discuss setting up a Node.js webserver for the first time and
|
||||||
my experiences with it thus far.
|
|my experiences with it thus far.
|
||||||
hr
|
hr
|
||||||
p.
|
p
|
||||||
I have had this site up for awhile now, but I've decided to turn it
|
|I have had this site up for awhile now, but I've decided to turn it
|
||||||
into a blog style website, more or less. I first started working on the site
|
|into a blog style website, more or less. I first started working on the site
|
||||||
because I wanted to learn new web development tools, in this case, Node.js and MongoDB.
|
|because I wanted to learn new web development tools, in this case, Node.js and MongoDB.
|
||||||
p.
|
p
|
||||||
I already had previous experience with SQL databases and other server side scripting
|
|I already had previous experience with SQL databases and other server side scripting
|
||||||
languages such as PHP and JSP, but I heard good things about Node.js and I wanted to
|
|languages such as PHP and JSP, but I heard good things about Node.js and I wanted to
|
||||||
familiarize myself with a NoSQL database. At first, Node.js was a bit confusing to work
|
|familiarize myself with a NoSQL database. At first, Node.js was a bit confusing to work
|
||||||
with and figure everything out. Now that I am starting to get the hang of Node and MongoDB
|
|with and figure everything out. Now that I am starting to get the hang of Node and MongoDB
|
||||||
I am enjoying them more and more.
|
|I am enjoying them more and more.
|
||||||
|
|
||||||
h2 Setting up Node.js for the first time
|
h2 Setting up Node.js for the first time
|
||||||
p.
|
p
|
||||||
There are multiple ways to get up and running with Node. Node uses "modules" and has some
|
|There are multiple ways to get up and running with Node. Node uses "modules" and has some
|
||||||
that are already built in. Others need to be installed with the NPM package manager, which
|
|that are already built in. Others need to be installed with the NPM package manager, which
|
||||||
will become your friend. I am going focus on installing Node.js with Express, which is a
|
|will become your friend. I am going focus on installing Node.js with Express, which is a
|
||||||
web framework for Node.js.
|
|web framework for Node.js.
|
||||||
code$ sudo apt-get install nodejs
|
code $ sudo apt-get install nodejs
|
||||||
br
|
br
|
||||||
code$ sudo apt-get install npm
|
code $ sudo apt-get install npm
|
||||||
br
|
br
|
||||||
p.
|
p
|
||||||
Once you have both Node.js and NPM installed, install Express and MongoDB.
|
|Once you have both Node.js and NPM installed, install Express and MongoDB.
|
||||||
We are going to install and use express generator to easily create a skeleton that we can
|
|We are going to install and use express generator to easily create a skeleton that we can
|
||||||
work from.
|
|work from.
|
||||||
code$ npm install express-generator -g
|
code $ npm install express-generator -g
|
||||||
br
|
br
|
||||||
p
|
p
|
||||||
|Based on your system, installing MongoDB may be a bit different.
|
|Based on your system, installing MongoDB may be a bit different.
|
||||||
a(href="http://docs.mongodb.org/manual/") Here is a guide on how to install.
|
a(href="http://docs.mongodb.org/manual/") Here is a guide on how to install.
|
||||||
p Once express generator is installed, it is extremely simple to set up a new Node application.
|
p Once express generator is installed, it is extremely simple to set up a new Node application.
|
||||||
code$ express myapp
|
code $ express myapp
|
||||||
br
|
br
|
||||||
p This will generate a new fold "myapp" with prebuild folders and files.
|
p This will generate a new fold "myapp" with prebuild folders and files.
|
||||||
code$ cd myapp
|
code $ cd myapp
|
||||||
br
|
br
|
||||||
code$ npm install
|
code $ npm install
|
||||||
br
|
br
|
||||||
code$ npm start
|
code $ npm start
|
||||||
p.
|
p
|
||||||
Now as easy as that sounds, you have a Node web application running on your machine.
|
|Now as easy as that sounds, you have a Node web application running on your machine.
|
||||||
You can navigate to your web app at localhost:3000 (It's configured to use port 3000 by default)
|
|You can navigate to your web app at localhost:3000 (It's configured to use port 3000 by default)
|
||||||
p
|
p
|
||||||
|Express organizes everything nicely in the
|
|Express organizes everything nicely in the
|
||||||
a(href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller") Model View Controller
|
a(href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller") Model View Controller
|
||||||
@@ -55,6 +55,6 @@ div.blog-post
|
|||||||
|If you are implementing a database, you would also create a "models" folder.
|
|If you are implementing a database, you would also create a "models" folder.
|
||||||
|There is also a folder which contains Node modules.
|
|There is also a folder which contains Node modules.
|
||||||
|When you use NPM to install new modules this is where they will be located.
|
|When you use NPM to install new modules this is where they will be located.
|
||||||
p.
|
p
|
||||||
Node is a very powerful tool that I plan on exploring more in the future.
|
|Node is a very powerful tool that I plan on exploring more in the future.
|
||||||
As development of this site continues, I plan to submit more content similar to this.
|
|As development of this site continues, I plan to submit more content similar to this.
|
||||||
@@ -69,7 +69,10 @@ block content
|
|||||||
option(value=i)= i
|
option(value=i)= i
|
||||||
select.form-control.timeForm(name="minutes")
|
select.form-control.timeForm(name="minutes")
|
||||||
-for(var i = 1; i < 60; i++)
|
-for(var i = 1; i < 60; i++)
|
||||||
option(value=i)= i
|
if(i < 10)
|
||||||
|
option(value="0" + i)= "0" + i
|
||||||
|
else
|
||||||
|
option(value=i)= i
|
||||||
select.form-control.timeForm(name="ampm")
|
select.form-control.timeForm(name="ampm")
|
||||||
option(value="am") AM
|
option(value="am") AM
|
||||||
option(calue="pm") PM
|
option(calue="pm") PM
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ extends layout
|
|||||||
block content
|
block content
|
||||||
div.header
|
div.header
|
||||||
div.centerDiv
|
div.centerDiv
|
||||||
h1.headerText.textCenter mitchellG.me
|
|
||||||
|
|
||||||
div.container
|
div.container
|
||||||
div.form-signin
|
div.form-signin
|
||||||
|
|||||||
Reference in New Issue
Block a user