Giter Site home page Giter Site logo

fullstack's Introduction

fullstack

Simple Mongoose-Express-Angular-Node "contact book" application, with Karma/Jasmine unit tests.

NOTE: this doesn't use nice things like express-generator, yeoman, grunt, and so on, more "bare bones".

PREREQUISITES:

1. Install Mongo and Node

2. Setup and start Mongo in one command window:

    md \data\db
    c:\path\to\mongod.exe

PACKAGES and CODE (NON-GIT APPROACH):

1. In another command window, create project and install node packages:

    mkdir fullstack (or any project name <app> you choose)
    cd <app>
    npm init (all defaults except specify server.js instead of index.js for main server)
    npm install --save express
    npm install --save ejs
    npm install --save angular
    npm install --save mongoose (mongodb client)
    npm install --save-dev nodemon

2. Develop the application:

    mkdir <app>/app, create <app>/app/index.html and <app>/app/app.js with the angular page html and code
    create <app>/models/Contact.js with the Contact model
    create <app>/routes/contacts.js with the /contacts route code
    create <app>/server.js with the express app code
    add <app>/package.json script "dev" "nodemon index.js"

PACKAGES and CODE (GIT APPROACH):

1. If you started with cloning the Git repository, then:

    npm install

RUNNING

1. Run the development server:

    npm run dev

2. Open your browser to localhost:3000 and use the application:

A. Enter a first name into the "New" field and click "Create"

B. Click on the first name which now appears in the table

C. Add a last name, address, and/or company, and click "Save"

The last saved data is now displayed on the right side of the screen.

UNIT TESTING

1. If you did not clone from the Git repository:

A. install the unit testing libraries:

    npm install --save-dev karma karma-jasmine jasmine-core karma-chrome-launcher
    npm install --save-dev angular-mocks angular-resource angular-route
    karma init (all defaults)
    npm install -g karma-cli

B. In karma.conf.js:

    // list of files / patterns to load in the browser
    files: [
    './node_modules/angular/angular.js',
    './node_modules/angular-resource/angular-resource.js',
    './node_modules/angular-route/angular-route.js',
    './node_modules/angular-mocks/angular-mocks.js',
    './app/app.js',
    './spec/*Spec.js'
    ]

C. In package.json, add script "test" -> "karma start"

2. Run the tests:

    npm run test

NOTE: There is an "extension" of this simple project which adds optional AWS S3 image storage here:

https://github.com/montsamu/fullstack-s3

fullstack's People

Contributors

montsamu avatar

Watchers

 avatar James Cloos 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.