Coder Social home page Coder Social logo

hengkiardo / express4-bootstrap-starter Goto Github PK

View Code? Open in Web Editor NEW
321.0 21.0 69.0 1.22 MB

Lightweight Bootstrap NodeJS Apps Build Using ExpressJS 4, MongoDB/Mongoose, Authentication with Passport.js, Jade and GruntJS as Task Automation

Home Page: https://express4-bootstrap-starter.herokuapp.com

License: Apache License 2.0

JavaScript 69.16% CSS 21.42% HTML 9.42%

express4-bootstrap-starter's Introduction

ExpressJS 4 Starter

ExpressJS 4 Starter

![Gitter](https://badges.gitter.im/Join Chat.svg)

Lightweight Bootstrap NodeJS Apps Build Using ExpressJS 4, MongoDB/Mongoose, Authentication with Passport.js, Jade and GruntJS as Task Automation

Build Status Dependencies Status Built with Grunt

Install

Prerequisites

  • Node.js - Download and Install Node.js with NVM (Node Version Manager) - Simple bash script to manage multiple active node.js versions.
  • MongoDB - Download and Install MongoDB - Make sure it's running on the default port.

Tool Prerequisites

  • NPM - Node.js package manager, should be installed when you install node.js. NPM (Node Package Manager) will look at the package.json file in the root of the project and download all of the necessary dependencies and put them in a folder called node_modules
  • Genghis - The single-file MongoDB admin app

Javascript Tools Used

  • Grunt - In one word: automation. The less work you have to do when performing repetitive tasks like minification, compilation, unit testing, linting, etc, the easier your job becomes. After you've configured it, a Grunt can do most of that mundane work for you—and your team—with basically zero effort.

NOTE: After installing Node.js and MongoDB server has running, then its time to run your server (this app!).

  $   git clone [email protected]:aredo/express4-bootstrap-starter.git       \
  &&  cd express4-bootstrap-starter                                       \
  &&  npm install                                                         \
  &&  cp app/config/config.example.js app/config/config.js                \
  &&  grunt                                                               \
  &&  open http://localhost:3001/

Then visit http://localhost:3001/ (if not taken automatically)

NPM Modules Used

  • Express - Express is a minimal and flexible node.js web application framework, providing a robust set of features for building single and multi-page, and hybrid web applications.
  • Passport - Passport is authentication middleware for Node.js. Extremely flexible and modular, Passport can be unobtrusively dropped in to any Express-based web application. A comprehensive set of strategies support authentication using a username and password, Facebook, Twitter, and more.
  • Mongoose - Elegant MongoDB object modeling for Node.JS. Mongoose provides a straight-forward, schema-based solution to modeling your application data and includes built-in type casting, validation, query building, business logic hooks and more, out of the box.
  • LESS.JS - Less is a CSS pre-processor, meaning that it extends the CSS language, adding features that allow variables, mixins, functions and many other techniques that allow you to make CSS that is more maintainable, themable and extendable.

Directory structure

-app/
  |__config/
  |__controllers/
  |__helper
  |__models/
  |__mailer/
  |__views/
  |__routes

-public/
  |__css (all files will generate from Grunt)
  |__js
  |__less
  |__fonts
  |__img
  favicon.ico
-Grunfile.coffee

Troubleshooting

During install some of you may encounter some issues feel free to contact me @hengkiardo or submit issue. via the repository issue tracker or the links provided below. I am also available on twitter @hengkiardo.

express4-bootstrap-starter's People

Contributors

anatolyben avatar beautyfree avatar gitter-badger avatar hengkiardo avatar johnlockwood avatar kahwee avatar mralexgray 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  avatar  avatar

express4-bootstrap-starter's Issues

Messy input cause server crash

I submitted Tricks form with this input :

"'"'"'*"'*"ù$"'$ù"'$"'$'$"$'ù"'$'^"'ù"'$^ù$'ù "$' $"'' "$ ù'  $"    {}{}{}{}{}{}{

... and provoked an Application Error that made the whole application crash. I thought there were an error handler but it seems it did not handle that kind of messy input.

Grunt - tasks for Heroku deployment

Firstly, thanks for sharing a great resource. Im learning a great deal. Newbie question im afraid ;)

Im confused as to which Grunt task I should run for deploying to Heroku. I see there are dev and production tasks and running production generates the /public/assets directory. All good.

Questions:

  • Should i add the /public/assets directory to the src i.e. remove the .gitIgnore entry so that the files are tracked and therefore deployed to Heroku?
  • Why are there grunt aliases for heroku:production and heroku:development.

Perhaps im missing a feature of Heroku that can run these tasks post deploy?

Appreciate any comments and thanks again for sharing a great resource.

screenshot sub-directory

Hi Hengki

You might want to make sure that the public/screenshot directory exists by default

Otherwise the app can't create the screenshots in this sub-directory

Thanks

express-session messages

these messages keep coming up:

body-parser deprecated urlencoded: explicitly specify "extended: true" for exten
ded parsing app\config\express.js:52:22
express-session deprecated undefined resave option; provide resave option app\co
nfig\express.js:57:11
express-session deprecated undefined saveUninitialized option; provide saveUnini
tialized option app\config\express.js:57:11

This can be fixed by adding "resave": true/false and "saveUninitialized": true/false to app.js

app.use(bodyParser.urlencoded({
extened: true
}));
app.use(session({
resave: true,
saveUninitialized: true,
extened: true,
secret: pkg.name,
store: new MongoStore({
url: app.config.database.url,
collection : 'sessions',
auto_reconnect: true
})

more info http://stackoverflow.com/questions/24477035/express-4-0-express-session-with-odd-warning-message

issue of phantom

For the file of app / models / trick.js,there is no param phantom in the /config/config.js.
So Line 4 of app / models / trick.js, "config.phantom" needs to be deleted.
Or add an obj in the /config/config.js such as:
phantom : {}

Grunt issue

Hi,

There appears to be an issue with the current master code, whereby npm install results in:

Binary is fine; exiting

[email protected] postinstall /Users/jamesallchin/Downloads/express4-bootstrap-starter-master
grunt production

Loading "Gruntfile.coffee" tasks...ERROR

Error: Cannot find module '/Users/jamesallchin/Downloads/express4-bootstrap-starter-master/app/config/config'
Warning: Task "production" not found. Use --force to continue.

Aborted due to warnings.

npm ERR! [email protected] postinstall: grunt production
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the Express4-Bootstrap-Starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! grunt production
npmnpm ERR! You can get their info via:
npm ERR! npm owner ls Express4-Bootstrap-Starter
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/jamesallchin/Downloads/express4-bootstrap-starter-master
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/jamesallchin/Downloads/express4-bootstrap-starter-master/npm-debug.log
npm ERR! not ok code 0

TypeError: Cannot read property 'length' of undefined

✔ Express server listening on port 3001 in development mode

/Users/peter/Desktop/stu/express4-bootstrap-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:246
throw message;
^
TypeError: Cannot read property 'length' of undefined
at processResults (/Users/peter/Desktop/stu/express4-bootstrap-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1581:31)
at /Users/peter/Desktop/stu/express4-bootstrap-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1619:20
at /Users/peter/Desktop/stu/express4-bootstrap-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1157:7
at /Users/peter/Desktop/stu/express4-bootstrap-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1890:9
at Server.Base._callHandler (/Users/peter/Desktop/stu/express4-bootstrap-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:448:41)
at /Users/peter/Desktop/stu/express4-bootstrap-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:481:18
at MongoReply.parseBody (/Users/peter/Desktop/stu/express4-bootstrap-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
at null. (/Users/peter/Desktop/stu/express4-bootstrap-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:439:20)
at EventEmitter.emit (events.js:95:17)
at null. (/Users/peter/Desktop/stu/express4-bootstrap-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:201:13)

App crashed when running grunt

Hi @Aredo , I got the following error when running grunt following your instruction :

[nodemon] app crashed - waiting for file changes before starting...

Any hints?

Cannot find module 'lusca'

When I try to run 'node server.js' I get the following error:

module.js:340
    throw err;
    ^
Error: Cannot find module 'lusca'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/brasilikum/express4-bootstrap-starter/app/config/express.js:11:24)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

[email protected] fails

npm install is failing for me. It looks like there is an issue with node-gyp or the fact that I am using Node 0.12.0. Any recommendations to resolve? Here is the log

$ npm install
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN engine [email protected]: wanted: {"node":"0.10.x"} (current: {"node":"0.12.0","npm":"2.5.1"})

[email protected] install /Users/tyler.harrington/Desktop/express4-bootstrap-starter/node_modules/email-templates/node_modules/juice2/node_modules/jsdom/node_modules/contextify
node-gyp rebuild

child_process: customFds option is deprecated, use stdio instead.
CXX(target) Release/obj.target/contextify/src/contextify.o
../src/contextify.cc:34:17: error: no member named 'ContextDisposedNotification'
in 'v8::V8'
v8::V8::ContextDisposedNotification();
~~~~~~~~^
1 error generated.
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Darwin 14.1.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/tyler.harrington/Desktop/express4-bootstrap-starter/node_modules/email-templates/node_modules/juice2/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/tyler.harrington/Desktop/express4-bootstrap-starter/npm-debug.log
tylerharrin-ltm:express4-bootstrap-starter tyler.harrington$

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.