Skip to content

igorprado/angular-requirejs-gulp-express-mongodb-seed

Repository files navigation

AngularJS / RequireJS / Gulp / Express / MongoDB Seed

Demo

Demo available: http://beer-project.herokuapp.com/beers

About

I wanted to learn about:

So I started this seed! This seed is based on Angular Express Seed.

Express is used to serve the static files, templates to AngularJS and provide a RESTful API to manipulate MongoDB collections.

Gulp is used to build our frontend files (CSS, JS and optimize images).

How to use this seed

Install

Clone this repo:

git clone [email protected]:igorprado/angular-requirejs-gulp-express-mongodb-seed.git

Run npm install to install the dependencies:

npm install

Install Gulp globally:

npm install gulp -g

Running the app

Build the frontend files running:

gulp

For development, use gulp watch to build the frontend files automatically.

Configure your MongoDB database and credentials on app.js:

mongoose.connect('mongodb://<user>:<pass>@<host>:<port>/<db>');

NOTE: If you don't have a MongoDB on your development machine, a simple way to start with this app is create a free MongoDB instance at Mongolab.

Runs like a typical express app:

node app.js

For development enviroment, I recommend Supervisor.

Running tests

I have to learn more about tests. So, it's on my roadmap for this seed.

Directory Layout

app.js              --> App config
package.json        --> For npm
bower.json          --> Frontend libs dependencies
frontend/           --> All of the source files to be used in on the client side (will be compiled on public/)
  sass/             --> Stylesheet files
    app.sass        --> Default sass stylesheet
    includes/       --> Divide our stylesheet in parts
  img/              --> Image files
  js/               --> Javascript files
    app.js          --> Declare top-level app module
    main.js         --> Default config for RequireJS
    beers/          --> Our app is divided by modules. This is an example module
      controllers/  --> All controllers of our module
      services/     --> All services of our module
      beers.js      --> Declare our module and routes config
    directives/     --> Define our application directives
  lib/              --> Our bower dependencies are installed here
public/             --> Our genereted files will be placed here (after run gulp)
routes/
  api.js            --> Top-level route config
  index.js          --> Route for serving HTML pages and partials (AngularJS templates)
  api/              --> All route configs of our modules will be here
    beers.js        --> Our example module route config.
views/
  index.jade        --> Main page for app, where the top-level ui-view is defined
  layout.jade       --> Doctype, title, head boilerplate
  partials/         --> Angular view partials (partial jade templates)
    index.jade      --> The default state (for UI Router)
    beers/          --> All the templates for our module are listed here

Example App

A simple beer management app is running and using this seed.

Support

Feel free to comment, fork or upgrade this code.

License

MIT

Releases

No releases published

Packages

No packages published