Angularjs + node.js + MongoDB development of the address book based on the location of the German map _node.js

Source: Internet
Author: User
Tags mongodb

One, the chatter

One day the monitor said, the students want me to develop a can share the address book, so I simply designed the next function. Including user roles, publishing microblogging, sharing location, and so on. This is also a bit selfish, in order to exercise the recently seen Angularjs, so decisively choose Node.js + MongoDB + angular.js scheme. Of course, the experience of developing node.js is more and more profound. Remember, last year leader told me to try to make each service of node support only one business function, so that it can be more convenient to maintain. In particular, I wanted to make a node service particularly powerful. Now it seems leader's approach is right, I am more inclined to single node service function ...

Second, directly on dry goods

The database service is deployed in Aliyun; the static file server is GitHub page.

GitHub Project Address: Https://github.com/vczero/OurTimes

Online Experience Address: http://vczero.github.io/tuban/main.html

Not a picture of the ball ah, pictured above to show you 2 screenshots:

(1) Home

(2) Address Book

.... More to the online experience ...

Third, the project

Total Items: https://github.com/vczero/OurTimes

Developed the required services: Https://github.com/vczero/OurTimes/tree/master/server

Open a Web PC Client:https://github.com/vczero/ourtimes/tree/master/client-web

Developed a simple background management system: Https://github.com/vczero/OurTimes/tree/master/client-admin

Welcome everyone to fork, follow and share the code, build the front-end together and work hard.

Iv. Attach the entry file code of the web-pc end angular

Copy Code code as follows:



var app = Angular.module (' app ', [' ui.router ', ' ngcookies ']);


var server_base_url = ' http://127.0.0.1:3000/';


Initialize configuration


App.run ([' $rootScope ', function ($rootScope) {


$rootScope. AppName = ' graph class net ';


$rootScope. desc = ' Location based address book ';


$rootScope. Author = ' Ghost Rumor ';


$rootScope. _email = ' wlhmyit@126.com ';


}]);

List of services invoked


App.constant (' ServiceConfig ', {


Wei_content:server_base_url + ' Wei/get ',


Wei_zan:server_base_url + ' Wei/zan ',


Wei_comment:server_base_url + ' wei/comment ',


Wei_create:server_base_url + ' wei/create ',


User_get:server_base_url + ' User/get ',


User_login:server_base_url + ' User/login ',


User_register:server_base_url + ' User/register ',


User_common:server_base_url + ' User/getcommon ',


User_ben:server_base_url + ' User/getben ',


User_self:server_base_url + ' user/getself ',


User_common_update:server_base_url + ' User/updatecommon ',


User_ben_update:server_base_url + ' User/updateben ',


User_ben_get_name:server_base_url + ' User/singleben/name ',


User_common_get_nickname:server_base_url + ' User/getcommon/name ',


User_ben_get_realname:server_base_url + ' User/singleben/name ',


Wei_get_token_page:server_base_url + ' Wei/getbytoken ',


Wei_delete:server_base_url + ' Wei/delete ',


User_update_password:server_base_url + ' User/updatepassword ',


Article_get:server_base_url + ' Article/get ',


Article_detail:server_base_url + ' article/get/id ',


Amap_url: ' Http://webapi.amap.com/maps?v=1.3&key=ad925c5003760094713775d64748d872&callback=init '


});


JSON Parse


App.config ([' $httpProvider ', function ($httpProvider) {


$httpProvider. defaults.headers.post[' content-type '] = ' application/x-www-form-urlencoded;charset=utf-8 ';


$httpProvider. defaults.headers.put[' content-type '] = ' application/x-www-form-urlencoded;charset=utf-8 ';


$httpProvider. Defaults.transformrequest = [function (data) {


var obj = [];


for (var key in data) {


Obj.push (key + ' = ' + Data[key]);


}


Return Obj.join (' & ');


}];


}]);


Routing configuration


App.config ([' $stateProvider ', ' $urlRouterProvider ',


function ($stateProvider, $urlRouterProvider) {


/*url Routing * *


$urlRouterProvider. Otherwise ("/");


/* Status Configuration */


$stateProvider


Home


. State (' index ', {


URL: '/',


Views: {


'': {


Templateurl: ' views/index/index.html ',


},


' Header@index ': {


Templateurl: ' views/header.html ',


Controller: ' Headercontroller '


},


' Footer@index ': {


Templateurl: ' views/footer.html ',


Controller: '


},


' Weibo@index ': {


Templateurl: ' views/index/weibo.html ',


Controller: ' Weibocontroller '


},


' Article@index ': {


Templateurl: ' views/index/article.html ',


Controller: ' Articlecontroller '


},


' Post@index ': {


Templateurl: ' views/index/post.html ',


Controller: ' Postweibocontroller '


}


}


})


. State (' login ', {


URL: '/login ',


Views: {


'': {


Templateurl: ' views/login/login.html ',


Controller: ' Logincontroller '


}


}


})


. State (' register ', {


URL: '/register ',


Views: {


'': {


Templateurl: ' views/register/register.html ',


Controller: ' Registercontroller '


}


}


})


. State (' contacts ', {


URL: '/contacts ',


Views: {


'': {


Templateurl: ' views/contacts/contacts.html ',


Controller: '


},


' Header@contacts ': {


Templateurl: ' views/header.html ',


Controller: ' Headercontroller '


},


' Userinfo@contacts ': {


Templateurl: ' views/contacts/userinfo.html ',


Controller: ' Userinfocontroller '


},


' Map@contacts ': {


Templateurl: ' views/contacts/map.html ',


Controller: ' Mapcontroller '


},


' Search@contacts ': {


Templateurl: ' views/contacts/search.html ',


Controller: ' Searchusercontroller '


}


}


})


. State (' Ucenter ', {


URL: '/ucenter ',


Views: {


'': {


Templateurl: ' views/ucenter/ucenter.html ',


Controller: '


},


' Header@ucenter ': {


Templateurl: ' views/header.html ',


Controller: ' Headercontroller '


},


' Userweibo@ucenter ': {


Templateurl: ' views/ucenter/weibo.html ',


Controller: ' Ucweibocontroller '


},


' Userdetailinfo@ucenter ': {


Templateurl: ' views/ucenter/user.html ',


Controller: ' Ucusercontroller '


},


' Footer@ucenter ': {


Templateurl: ' views/footer.html ',


Controller: '


}


}


})


. State (' article ', {


URL: '/article/:id ',


Views: {


'': {


Templateurl: ' views/article/article.html ',


Controller: '


},


' Header@article ': {


Templateurl: ' views/header.html ',


Controller: ' Headercontroller '


},


' Article_content@article ': {


Templateurl: ' views/article/article_content.html ',


Controller: ' Articledetailcontroller '


},


' Footer@article ': {


Templateurl: ' views/footer.html ',


Controller: '


}


}


})


. State (' Article_index ', {


URL: '/article ',


Views: {


'': {


Templateurl: ' views/article/article.html ',


Controller: '


},


' Header@article_index ': {


Templateurl: ' views/header.html ',


Controller: ' Headercontroller '


},


' Article_content@article_index ': {


Templateurl: ' views/article/article_content.html ',


Controller: ' Articledetailcontroller '


},


' Footer@article_index ': {


Templateurl: ' views/footer.html ',


Controller: '


}


}


});

}]);

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.