What We’ll Be Building
A lot of the applications we’ve dealt with so far had a specific function, like our Node and Angular To-Do Single Page Application. We are going to step away from that and just a good old getting started application.
This will be very barebones but hopefully it will help you set up your applications. Let’s just call it a starter kit.
APPLICATION REQUIREMENTS
- Single Page Application
- Node.js backend with Express and MongoDB
- AngularJS frontend
- Modular Angular components (controllers, services)
- Good application structure so our app can grow
The Backend Node, MongoDB, Express
Three letters out of the MEAN stack will be handled on the backend, our server. We will create our server, configure our application, and handle application routing.
TOOLS REQUIRED
We will need Node and to make our lives easier, we’ll use bower to pull in all our dependencies.
Application Structure
By the end of this tutorial, we will have a basic application structure that will help us develop our Node backend along with our Angular frontend. Here’s what it will look like.
- app
----- models/
---------- nerd.js <!-- the nerd model to handle CRUD -->
----- routes.js
- config
----- db.js
- node_modules <!-- created by npm install -->
- public <!-- all frontend and angular stuff -->
----- css
----- js
---------- controllers <!-- angular controllers -->
---------- services <!-- angular services -->
---------- app.js <!-- angular application -->
---------- appRoutes.js <!-- angular routes -->
----- img
----- libs <!-- created by bower install -->
----- views
---------- home.html
---------- nerd.html
---------- geek.html
----- index.html
- .bowerrc <!-- tells bower where to put files (public/libs) -->
- bower.json <!-- tells bower which files we need -->
- package.json <!-- tells npm which packages we need -->
- server.js <!-- set up our node application -->
We’ll be filling in our files into folder structure. All backend work is done in
server.js
, app
, and config
while all the frontend is handled in the public
folder.
Comments
Post a Comment