Merge remote-tracking branch 'origin/master'
* origin/master: Specified npm versions instead of latest (*) Update README.md Update Project Strcuture Add more client-side/Node libs, todo, screencast Conflicts: README.md
This commit is contained in:
33
README.md
33
README.md
@ -1,5 +1,5 @@
|
|||||||

|

|
||||||
Hackathon Starter
|
Hackathon Starter [](https://david-dm.org/sahat/hackathon-starter)
|
||||||
=================
|
=================
|
||||||
A kickstarter for **Node.js** web applications.
|
A kickstarter for **Node.js** web applications.
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ Features
|
|||||||
--------
|
--------
|
||||||
- **Local Authentication** using Email and Password
|
- **Local Authentication** using Email and Password
|
||||||
- **OAuth 2.0 Authentication** via Twitter, Facebook, Google or GitHub
|
- **OAuth 2.0 Authentication** via Twitter, Facebook, Google or GitHub
|
||||||
- Error and Success flash notifications
|
- Sweet Error and Success flash notifications with animations by *animate.css*
|
||||||
- MVC Project Structure
|
- MVC Project Structure
|
||||||
- LESS stylesheets (auto-compiled via Express middleware)
|
- LESS stylesheets (auto-compiled via Express middleware)
|
||||||
- Bootstrap 3 + Flat UI + iOS7 Theme
|
- Bootstrap 3 + Flat UI + iOS7 Theme
|
||||||
@ -39,7 +39,7 @@ Features
|
|||||||
- **Account Management**
|
- **Account Management**
|
||||||
- Profile Details
|
- Profile Details
|
||||||
- Change Password
|
- Change Password
|
||||||
- Link OAuth 2.0 strategies
|
- Link multipleOAuth 2.0 strategies to one account
|
||||||
- Delete Account
|
- Delete Account
|
||||||
- **API Examples**: Facebook, Foursquare, Last.fm, Tumblr, Twitter, and more.
|
- **API Examples**: Facebook, Foursquare, Last.fm, Tumblr, Twitter, and more.
|
||||||
|
|
||||||
@ -52,6 +52,7 @@ Prerequisites
|
|||||||
**Note**: If you are new to Node.js or Express framework,
|
**Note**: If you are new to Node.js or Express framework,
|
||||||
I highly recommend watching [Node.js and Express 101](http://www.youtube.com/watch?v=BN0JlMZCtNU) screencast that teaches Node and Express from scratch.
|
I highly recommend watching [Node.js and Express 101](http://www.youtube.com/watch?v=BN0JlMZCtNU) screencast that teaches Node and Express from scratch.
|
||||||
|
|
||||||
|
|
||||||
Getting Started
|
Getting Started
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ node app.js
|
|||||||
> **Note**: I strongly recommend installing nodemon `sudo npm install -g nodemon`.
|
> **Note**: I strongly recommend installing nodemon `sudo npm install -g nodemon`.
|
||||||
> It will monitor for any changes in your node.js
|
> It will monitor for any changes in your node.js
|
||||||
> application and automatically restart the server. Once installed, instead of `node app.js` use `nodemon app.js`.
|
> application and automatically restart the server. Once installed, instead of `node app.js` use `nodemon app.js`.
|
||||||
> It's a big time saver in the long run.
|
> It is a big time saver in the long run.
|
||||||
|
|
||||||
Next up, if you want to use any of the APIs or OAuth2 authentication methods, you will need to obtain
|
Next up, if you want to use any of the APIs or OAuth2 authentication methods, you will need to obtain
|
||||||
appropriate credentials: Client ID, Client Secret, API Key, or Username & Password. You will
|
appropriate credentials: Client ID, Client Secret, API Key, or Username & Password. You will
|
||||||
@ -111,6 +112,29 @@ Obtaining API Keys
|
|||||||
|
|
||||||
*TODO: Add Twitter and GitHub instructions.*
|
*TODO: Add Twitter and GitHub instructions.*
|
||||||
|
|
||||||
|
Project Structure
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
| ------------- |:-------------:|
|
||||||
|
| **config**/passport.js | Passport Local and OAuth strategies + Passport middleware. |
|
||||||
|
| **config**/secrets.js | Your API keys, tokens, passwords and database URL. |
|
||||||
|
| **controllers**/api.js | Controller for /api route and all api examples. |
|
||||||
|
| **controllers**/contact.js | Controller for contact form. |
|
||||||
|
| **controllers**/home.js | Controller for home page (index).
|
||||||
|
| **controllers**/user.js | Controller for user account management page. |
|
||||||
|
| **models**/User.js | Mongoose schema and model for User. |
|
||||||
|
| **public/*** | Static assets, i.e. fonts, css, js, img. |
|
||||||
|
| **views/account** | Templates relating to user account. |
|
||||||
|
| **views/api** | Templates relating to API Examples. |
|
||||||
|
| **views**/layout.jade | Base template. |
|
||||||
|
| **views**/home.jade | Home page template. |
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** There is no difference how you name or structure your views. You could place all your templates in a top-level `views` directory without having a nested folder structure, if that makes things easier for you. Just don't forget to update `extends ../layout` and corresponding `res.render()` method in controllers. For smaller apps, I find having a flat folder structure to be easier to work with.
|
||||||
|
|
||||||
|
**Note 2:** Although your main template - **layout.jade** only knows about `/css/styles.css` file, you should be editing **styles.less** stylesheet. Express will automatically generate **styles.css** whenever there are changes in LESS file. This is done via [less-middleware](https://github.com/emberfeather/less.js-middleware) node.js library.
|
||||||
|
|
||||||
Useful Tools
|
Useful Tools
|
||||||
------------
|
------------
|
||||||
[HTML to Jade converter](http://html2jade.aaron-powell.com)
|
[HTML to Jade converter](http://html2jade.aaron-powell.com)
|
||||||
@ -151,6 +175,7 @@ TODO
|
|||||||
----
|
----
|
||||||
- Pages that require login, should automatically redirect to last attempted URL on successful sign-in.
|
- Pages that require login, should automatically redirect to last attempted URL on successful sign-in.
|
||||||
- Add more API examples.
|
- Add more API examples.
|
||||||
|
- Mocha tests.
|
||||||
|
|
||||||
Contributing
|
Contributing
|
||||||
------------
|
------------
|
||||||
|
51
package.json
51
package.json
@ -2,31 +2,30 @@
|
|||||||
"name": "hackathon-starter",
|
"name": "hackathon-starter",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "*",
|
"async": "~0.2.10",
|
||||||
"bcrypt": "*",
|
"bcrypt": "~0.7.7",
|
||||||
"cheerio": "*",
|
"cheerio": "~0.13.1",
|
||||||
"connect-flash": "*",
|
"connect-flash": "~0.1.1",
|
||||||
"express": "*",
|
"express": "~3.4.8",
|
||||||
"express-validator": "*",
|
"express-validator": "~1.0.1",
|
||||||
"less-middleware": "*",
|
"fbgraph": "~0.2.8",
|
||||||
"request": "*",
|
"github-api": "~0.7.0",
|
||||||
"jade": "*",
|
"jade": "~1.1.5",
|
||||||
"mongoose": "*",
|
"lastfm": "~0.9.0",
|
||||||
"underscore": "*",
|
"less-middleware": "~0.1.15",
|
||||||
"passport": "*",
|
"mongoose": "~3.8.5",
|
||||||
"passport-oauth": "*",
|
"node-foursquare": "~0.2.0",
|
||||||
"passport-local": "*",
|
"passport": "~0.2.0",
|
||||||
"passport-github": "*",
|
"passport-facebook": "~1.0.2",
|
||||||
"passport-facebook": "*",
|
"passport-github": "~0.1.5",
|
||||||
"passport-twitter": "*",
|
"passport-google-oauth": "~0.1.5",
|
||||||
"passport-google-oauth": "*",
|
"passport-local": "~0.1.6",
|
||||||
|
"passport-oauth": "~1.0.0",
|
||||||
"lastfm": "*",
|
"passport-twitter": "~1.0.2",
|
||||||
"github-api": "*",
|
"request": "~2.33.0",
|
||||||
"sendgrid": "*",
|
"sendgrid": "~0.4.6",
|
||||||
"tumblr.js": "*",
|
"tumblr.js": "~0.0.4",
|
||||||
"twit": "*",
|
"twit": "~1.1.12",
|
||||||
"fbgraph": "*",
|
"underscore": "~1.5.2"
|
||||||
"node-foursquare": "*"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user