https://github.com/montsamu/fullstack
Simple Mongoose-Express-Angular-Node "contact book" application, with Karma/Jasmine unit tests.
https://github.com/montsamu/fullstack
Last synced: about 1 month ago
JSON representation
Simple Mongoose-Express-Angular-Node "contact book" application, with Karma/Jasmine unit tests.
- Host: GitHub
- URL: https://github.com/montsamu/fullstack
- Owner: montsamu
- Created: 2017-04-24T17:18:43.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-03T18:03:27.000Z (about 8 years ago)
- Last Synced: 2025-02-05T18:31:56.151Z (3 months ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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 you choose)
cd
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, create /app/index.html and /app/app.js with the angular page html and code
create /models/Contact.js with the Contact model
create /routes/contacts.js with the /contacts route code
create /server.js with the express app code
add /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