GithubHelp home page GithubHelp logo

robrighter / node-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
1.1K 36.0 161.0 1.79 MB

Everything you need to get started on a Node.js website with express and socket.IO

Shell 27.27% JavaScript 72.72%

node-boilerplate's Introduction

Node Boilerplate Version 2

Requires Node v0.6.6 (or newer) node-boilerplate takes html-boilerplate, express, connect, jade and Socket.IO and organizes them into a ready to use website project. It's a fast way to get working on your Node website without having to worry about the setup. It takes care of all the boring parts, like setting up your views, 404 page, 500 page, getting the modules organized, etc...

Node Boilerplate has 4 goals:

  1. To end the repetition involved with starting a new Node website project
  2. To never install anything outside of the project directory (For easier production deployment)
  3. To make it easy to install additional modules within the project directory
  4. To enable easy upgrade or freezing of project dependencies
    (These goals are much easier to meet now that node includes the node_modules convention)

To start a project:

	git clone git://github.com/robrighter/node-boilerplate.git mynewproject
	cd mynewproject
	./initproject.sh

This will copy down all of the boilerplate files, organize them appropriately and init a fresh new git repository within which you can build your next big thing.

To run the boilerplate template app:

	node server.js

Go to http://0.0.0.0:8081 and click on the send message link to see socket.io in action.

Additional Features:

  1. Creates a package.json file consistent with associated best practices (http://blog.nodejitsu.com/package-dependencies-done-right)
  2. Adds .gitignore for the node_modules directory
  3. Includes 404 page and associated route
  4. Includes 500 page

To add additional modules:

Update the package.json file to include new module dependencies and run 'npm install'.

If you have a different set of default modules that you like to use, the structure is setup such that you can fork the project and replace the module dependencies outlined in the ./templates/apps/package.json file to best fit your needs and the initproject.sh script will initialize projects with your new set of modules.

Deployment

node-boilerplate is setup to be easily deployed on a Joyent Node SmartMachine. This means that:

  1. The version of Node is defined in config.json and in package.json
  2. The main script to run is server.js
  3. The web server port is pulled from process.env.PORT

node-boilerplate's People

Contributors

cbrammer avatar dandv avatar erkan-yilmaz avatar jackowayed avatar robrighter avatar snaewe avatar wdavidw 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-boilerplate's Issues

Fails on Windows

Tried in straightforward way on Windows.
npm install failed (see log below), template git repository was not deleted, leaving the project in dirty state.

And yes, #29 Express is old 2.x

npm http 200 https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz
npm ERR! Error: ENOENT, lstat 'E:\Eclipse\Enide-Standard-kepler431-working-copy\ws\NodeBoilerplateProject1\node_modules\mongoose\node_modules\colors\package.json'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd E:\Eclipse\Enide-Standard-kepler431-working-copy\ws\NodeBoilerplateProject1
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! path E:\Eclipse\Enide-Standard-kepler431-working-copy\ws\NodeBoilerplateProject1\node_modules\mongoose\node_modules\colors\package.json
npm ERR! fstream_path E:\Eclipse\Enide-Standard-kepler431-working-copy\ws\NodeBoilerplateProject1\node_modules\mongoose\node_modules\colors\package.json
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:93:15)
npm ERR! Error: ENOENT, lstat 'E:\Eclipse\Enide-Standard-kepler431-working-copy\ws\NodeBoilerplateProject1\node_modules\mongoose\node_modules\hooks\package.json'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd E:\Eclipse\Enide-Standard-kepler431-working-copy\ws\NodeBoilerplateProject1
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! path E:\Eclipse\Enide-Standard-kepler431-working-copy\ws\NodeBoilerplateProject1\node_modules\mongoose\node_modules\hooks\package.json
npm ERR! fstream_path E:\Eclipse\Enide-Standard-kepler431-working-copy\ws\NodeBoilerplateProject1\node_modules\mongoose\node_modules\hooks\package.json
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT

im getting a line ending error on a unix command line, just a heads up

$ ./initproject.sh
-bash: ./initproject.sh: /bin/sh^M: bad interpreter: No such file or directory

there is a setting in git that corrects this problem for developers on windows machines

$ git config --global core.autocrlf true

in the meantime dos2unix or vim :set fileformat=unix should work.

Edit:
Curious, how long might i have to wait for a fix? I'm trying to figure out which way to go with this package. i would like to use it as a dependency for a grunt based package, but at the moment i have a couple of "fix it" commands in front of the initproject.sh to clean that file from line endings. I would like to remove those lines once this file gets fixed so i can commit my package in the cleaner state.

Cannot find module socket.io-node

Excellent package, however, I followed the instructions after a clone but got this error...

~/node/node-boilerplate node project/app.js
node.js:289
    throw new Error("Cannot find module '" + request + "'");
          ^
Error: Cannot find module 'socket.io-node'
 at loadModule (node.js:289:15)
 at require (node.js:420:14)
 at Object.<anonymous> (/home/markc/node/node-boilerplate/project/app.js:6:12)
 at Module._compile (node.js:472:25)
 at Module._loadScriptSync (node.js:482:10)
 at Module.loadSync (node.js:352:12)
 at Object.runMain (node.js:535:24)
 at node.js:760:10

CoffeeScript version?

Anybody interested in a port of this to CoffeeScript? I think it's a step in the right direction for readability with JavaScript. (Let me know if something like this exists already, but I really like the simplicity of this framework.)

This project seems outdated? Start using Expressling!

Hello!

I see we have some overlap with a boilerplate for Node.js --

In addition to being compatible with node 0.6.3, Expressling is kept up to date and contains a full MVC-style framework with routes/views/auth/db/sessions.

If possible, could your watchers/contributors help to merge options/features with Expressling?

We plan to continually improve and stay updated with Expressling :-).

Hop over to #expressling in Freenode and we can have a chat!

Express v3 ?

Thanks for the WIndows init script! I was just wondering, is there a reason this doesn't use Express 3 ?

Not working on Clean Install

I tried this project out yesterday and was getting this error page when I started server.js.
#Header#
The Server Encountered and Error
:(
Error: ENOENT, No such file or directory '/var/www/emotely.com/static/index.html'
#Footer#

I thought I might have messed up my environment so today I reinstalled even the operating system and started from scratch. I then only installed git, then node(built and installed), then downloaded your repo. And I still get the issue.

Any ideas? Do I need to install anything for the ejs templating system? Because I couldn't find anything related to that.

Francois

fatal error resulting in no modules/submodule

i get this after

$ ./bin/initproject.sh 

since today

fatal: http://github.com/LearnBoost/Socket.IO.git/info/refs not found: did you run git update-server-info on the server?

then alot of errors where it tries to copy the html5 boilerplate and a ls in the lib folders shows me that's nothing in it.

How to update the submodules?

Sorry if this is a silly question. But because i'm really not familiar with git and i couldn't find good tutorial to go with. How do i update the submodules. What i want is the latest version. Not the one in this repository. Thanks.

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.