Git Product home page Git Product logo

defaultnodeproj's Introduction

#Starting Out

###Things to install

###Setting up the repo

  • Create new repo on Github
  • Clone it down, git clone [email protected]:stolksdorf/sample_proj.git
  • Create a new app at Heroku
  • Add it to your repo, git remote add heroku [email protected]:sample_proj.git
  • git push origin master updates your github repo
  • git push origin heroku deploys your app to Heroku

###Getting Configured

  • Run npm init to setup your packages.json. Fill out whatever you like, but we're using app.js as the entry point
  • Pull in needed Node packages.
    • npm install ejs --save
    • npm install express --save
    • npm install mongodb --save
    • npm install mongoose --save
    • npm install underscore --save
  • Add MongoDB to your project. heroku addons:add mongohq
  • Copy in modules, public, views, app.js, and Procfile

###Run your App

  • node app.js will start your server listening on port 5000
  • Go to localhost:5000 to see your app in action.
  • To see changes in server-side code, you'll you'll need to restart the server. ctrl+C + node app.js
  • To see changes in client-side code, just refresh the web page

#Structure Explained

###Server Side

  • modules - Where all your server side JS is kept.
  • modules/models - DB models here. Include in a schema, statics, and methods
  • modules/middleware.js - Middleware is code that's ran within an async stack. Things like: request -> [load user -> is user admin?] -> return page. Middleware is in the brackets.
  • node_modules - Code for the node packages we pulled in using npm are stored here. Don't touch.
  • app.js - Our heart of our apllication. Setups up our server and declares any resources we need.
  • package.json - Machine readable description of our project. Let's Heroku know what it should do with the project.
  • Procfile - Command(s) that Heroku will run when it spins up a dyno.

###Client Side

defaultnodeproj's People

Contributors

stolksdorf avatar

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.