forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 2
Angular Backend File Structure
Quincy Larson edited this page Aug 20, 2016
·
1 revision
Your app's backend api that interacts with your database is located in /server/api
Let's take a look at /server/api/thing:
- index.js: this file routes the $http API requests made from your app's front-end to the appropriate function in thing.controller.js
- thing.controller.js: Here is where we actually deal with the database! Take a minute to look through here and figure out what's going on. These functions will: return all items in a collection, return a single item from a collection when passed its id, post an item to a collection, update an item in the collection (this doesn't really work as intended out of the box, we're going to fix that in a minute), and of course, delete an item from the collection.
- thing.model.js: Here, the actual structure of a thing object is defined. You can add or remove any fields you want from the thing model, and as long as they're syntactically correct they won't break anything, even if there are things with different schemas in your database already. But! You don't just have to edit the thing model to make a new type of collection, because generator-angular-fullstack can do it for you!
Learn to code and help nonprofits. Join our open source community in 15 seconds at http://freecodecamp.com
Follow our Medium blog
Follow Quincy on Quora
Follow us on Twitter
Like us on Facebook
And be sure to click the "Star" button in the upper right of this page.
New to Free Code Camp?
JS Concepts
JS Language Reference
- arguments
- Array.prototype.filter
- Array.prototype.indexOf
- Array.prototype.map
- Array.prototype.pop
- Array.prototype.push
- Array.prototype.shift
- Array.prototype.slice
- Array.prototype.some
- Array.prototype.toString
- Boolean
- for loop
- for..in loop
- for..of loop
- String.prototype.split
- String.prototype.toLowerCase
- String.prototype.toUpperCase
- undefined
Other Links