This document provides an overview of how to structure a MEAN stack application using MongoDB, Express, AngularJS, and Node.js. It outlines the file structure, including folders for modules, routes, views, and public files. It also includes examples of configuring Express, defining routes, and models for interacting with MongoDB via Mongoose.
14. app.js
// Routes
app.get('/', routes.index);
app.get('/user/:id, routes.user);
// JSON API
app.get('/api/user/:id, api.userGet);
app.post('/api/user, api.userPost);
app.put('/api/user, api.userPut);
app.delete('/api/user, api.userDelete);
// redireciona todas outras para o index
app.get('*', routes.index);