├── .project ├── LICENSE ├── README.md ├── app.js ├── bin └── www ├── package.json ├── public ├── images │ ├── 11.png │ ├── body-bg.png │ ├── header-bg.jpg │ ├── index_banner_five_BRQvS.png │ ├── logo-osc-white.png │ ├── lv_bg.png │ ├── re_bg.jpg │ └── space-banner.jpg ├── node_blog_mongodb数据库名_picture │ ├── login.json │ ├── message.json │ └── news.json └── stylesheets │ ├── bootstrap.css │ ├── login_css.css │ └── style.css ├── routes ├── index.js └── users.js └── views ├── error.ejs ├── index.ejs ├── login.ejs ├── register.ejs └── showlist.ejs /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | node_boke 4 | 5 | 6 | 7 | 8 | 9 | com.aptana.ide.core.unifiedBuilder 10 | 11 | 12 | 13 | 14 | 15 | com.aptana.projects.webnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # node_Blog 2 | This is demo with node.Includes a combination of node and mongdb databases.Implementing routing in node 3 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var path = require('path'); 3 | var favicon = require('serve-favicon'); 4 | var logger = require('morgan'); 5 | var cookieParser = require('cookie-parser'); 6 | var bodyParser = require('body-parser'); 7 | var session=require('express-session'); 8 | 9 | var index = require('./routes/index'); 10 | var users = require('./routes/users'); 11 | 12 | var app = express(); 13 | 14 | // view engine setup 15 | app.set('views', path.join(__dirname, 'views')); 16 | app.set('view engine', 'ejs'); 17 | 18 | // uncomment after placing your favicon in /public 19 | //app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); 20 | app.use(logger('dev')); 21 | app.use(bodyParser.json()); 22 | app.use(bodyParser.urlencoded({ extended: false })); 23 | app.use(cookieParser()); 24 | app.use(express.static(path.join(__dirname, 'public'))); 25 | 26 | app.use(session({ 27 | secret: 'recommend 128 bytes random string', 28 | cookie: { maxAge: 2000 * 60 * 1000 }, 29 | resave: true, 30 | saveUnintialized: true 31 | })) 32 | 33 | 34 | 35 | app.use('/', index); 36 | app.use('/users', users); 37 | 38 | // catch 404 and forward to error handler 39 | app.use(function(req, res, next) { 40 | var err = new Error('Not Found'); 41 | err.status = 404; 42 | next(err); 43 | }); 44 | 45 | // error handler 46 | app.use(function(err, req, res, next) { 47 | // set locals, only providing error in development 48 | res.locals.message = err.message; 49 | res.locals.error = req.app.get('env') === 'development' ? err : {}; 50 | 51 | // render the error page 52 | res.status(err.status || 500); 53 | res.render('error'); 54 | }); 55 | 56 | module.exports = app; 57 | -------------------------------------------------------------------------------- /bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../app'); 8 | var debug = require('debug')('express:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "body-parser": "~1.17.1", 10 | "cookie-parser": "~1.4.3", 11 | "debug": "~2.6.3", 12 | "ejs": "~2.5.6", 13 | "express": "~4.15.2", 14 | "morgan": "~1.8.1", 15 | "serve-favicon": "~2.4.2" 16 | }, 17 | "devDependencies": { 18 | "express-session": "^1.15.2", 19 | "mongodb": "^2.2.25" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /public/images/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspdou/node_Blog/d5cec5250e3ccf7bae6e1c99e174976b4df8f54d/public/images/11.png -------------------------------------------------------------------------------- /public/images/body-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspdou/node_Blog/d5cec5250e3ccf7bae6e1c99e174976b4df8f54d/public/images/body-bg.png -------------------------------------------------------------------------------- /public/images/header-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspdou/node_Blog/d5cec5250e3ccf7bae6e1c99e174976b4df8f54d/public/images/header-bg.jpg -------------------------------------------------------------------------------- /public/images/index_banner_five_BRQvS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspdou/node_Blog/d5cec5250e3ccf7bae6e1c99e174976b4df8f54d/public/images/index_banner_five_BRQvS.png -------------------------------------------------------------------------------- /public/images/logo-osc-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspdou/node_Blog/d5cec5250e3ccf7bae6e1c99e174976b4df8f54d/public/images/logo-osc-white.png -------------------------------------------------------------------------------- /public/images/lv_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspdou/node_Blog/d5cec5250e3ccf7bae6e1c99e174976b4df8f54d/public/images/lv_bg.png -------------------------------------------------------------------------------- /public/images/re_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspdou/node_Blog/d5cec5250e3ccf7bae6e1c99e174976b4df8f54d/public/images/re_bg.jpg -------------------------------------------------------------------------------- /public/images/space-banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lspdou/node_Blog/d5cec5250e3ccf7bae6e1c99e174976b4df8f54d/public/images/space-banner.jpg -------------------------------------------------------------------------------- /public/node_blog_mongodb数据库名_picture/login.json: -------------------------------------------------------------------------------- 1 | {"_id":{"$oid":"58f20ab9f945c024e0a8e77d"},"user":"1","pass":"1"} 2 | {"_id":{"$oid":"591ed56b94e01110d8ed3457"},"user":"lishengpeng","pass":"lishengpeng"} 3 | {"_id":{"$oid":"591efd55195ef321c805395e"},"user":"1111","pass":"1111"} 4 | -------------------------------------------------------------------------------- /public/node_blog_mongodb数据库名_picture/message.json: -------------------------------------------------------------------------------- 1 | {"_id":{"$oid":"58f20c7c465a5f1e305d8738"},"tit":"html5的前景","con":"伴随着HTML5兴起的是Flash的没落,HTML5能打败在多媒体领域称霸多年的Flash,除了移动设备的跨平台性和较好的多媒体支持外,它的应用范围也广于Flash。比如,Flash动画作品的复用性极低,基本没有模板市场,而HTML5却能作为基础填充材料,用来制作报纸图文等模板。"} 2 | {"_id":{"$oid":"58f20e6884758a2708f035d8"},"tit":"css的样式","con":"CSS样式全称为Cascading Style Sheets,中文翻译为“层叠样式表”,简称样式表有被我们称为CSS样式或认知的div css样式,而CSS就是Cascading Style Sheets英文单词开头字母缩写,CSS样式是一种制作网页样式的新技术也就是本DIVCSS5介绍主题。"} 3 | {"_id":{"$oid":"591ed5ce94e01110d8ed3458"},"tit":"angular","con":"angular是有谷歌提供的JavaScript框架"} 4 | {"_id":{"$oid":"591efd7d195ef321c805395f"},"tit":"111","con":"11111"} 5 | -------------------------------------------------------------------------------- /public/node_blog_mongodb数据库名_picture/news.json: -------------------------------------------------------------------------------- 1 | {"_id":{"$oid":"58f17ac8cd1e7a06a857a9cd"},"tit":"源资讯 | 操作系统哪家强?Windows?Linux?还是国产","con":"每位程序员都有自己钟爱或熟悉的操作系统,每个操作系统又都有着一些让人诟病之处,比如Win 10 的不安全。院士倪光南认为 Win 10 不安全,中国必须用自主操作系统。他强调,我国并不是没有能力去开发操作系统,去做通用CPU,大型企业养几百个软件工程师没有问题,但是如果没有市场是不可能成功的。"} 2 | {"_id":{"$oid":"58f17b7fcd1e7a06a857a9ce"},"tit":"每日一博 | 六大要点解析负载均衡的原理","con":"所谓的“均衡”,不能狭义地理解为分配给所有实际服务器一样多的工作量,因为多台服务器的承载能力各不相同,这可能体现在硬件配置、网络带宽的差异,也可能因为某台服务器身兼多职,我们所说的“均衡”,也就是希望所有服务器都不要过载,并且能够最大程序地发挥作用。"} 3 | {"_id":{"$oid":"58f17bf1cd1e7a06a857a9cf"},"tit":"OSChina 周六乱弹 ——-----程序媛上班穿花裙同事这么说..","con":"手机党少年们想听歌,请使劲儿戳(这里)\r\n@啊陈 :早上上班遇到一个妹子主动跟我打招呼,唉!为什么不是我喜欢的类型呢?是我喜欢的类型就可以直接问她拿联系方式了。\r\n姑娘问啥?\r\n“是你吃的榴莲嘛!”\r\n@巴拉迪维 :每天一出电梯就闻到一股榴莲味,到底是谁在吃榴莲?搞得整个四楼都是榴莲味。 感觉快要窒息了。。。可以算是工伤吗?\r\n@小小编辑 :巴叔脱鞋 不能让他们好过了!"} 4 | {"_id":{"$oid":"58f17c29cd1e7a06a857a9d0"},"tit":"码云推荐 | Unity3D 自定义文件关联工具 CAHTool","con":"用一个配置文件来记录那些我们希望使用自定义工具打开的文件的扩展名,编写扩展编辑器窗口来编辑这个配置文件。\r\n编写扩展编辑器代码,通过OnOpenAsset编辑器属性命令拦截资源文件打开事件,并从文件路径中获取到文件扩展名。\r\n检查这个文件扩展名是否在配置文件中有记录,如果没有则不处理拦截,让Unity3D调用其默认的工具来打开文件, 否则处理拦截,通过调用Application类的OpenURL方法,让Unity3D使用操作系统中对应文件类型的默认编辑工具 来打开文件。"} 5 | {"_id":{"$oid":"58f17c7acd1e7a06a857a9d1"},"tit":"wxBot —— 基于 Python 的微信机器人框架","con":"wxBot 是用 Python 包装 Web 微信协议实现的微信机器人框架。以下的代码对所有来自好友的文本消息回复文本消息 hi 、图片消息 1.png 以及文件消息 1.png , 并不断向好友 tb 发送文本 schedule 。\r\n\r\nhandle_msg_all 函数用于处理收到的每条消息,而 schedule 函数可以做一些任务性的工作(例如不断向好友推送信息或者一些定时任务)。"} 6 | {"_id":{"$oid":"58f17caecd1e7a06a857a9d2"},"tit":"Drupal 核心开发者威胁退出,要求恢复 Garfield 职务","con":"Garfield 的非传统性行为是指调教,他参与了涉及性调教的 BDSM 和 Gorean 亚文化社区。现在,数十名核心 Drupal 开发者、贡献者和资助者联合发表了致 Dries Buytaert 的公开信,要求 Larry Garfield 恢复原职,如果要求得不到满足,他们将永远退出 Drupal 项目。\r\n\r\n公开信称,多元化不只是皮肤的深浅,认为以违背价值观而不是违反社区行为规范为由拒绝 Larry Garfield 不是正确的做法,称 Drupal 社区欢迎 BDSM 参与者,开发者和成员可以有自己信仰和价值观,有自己私生活的权利,专业生活和私生活应该是分离的。"} 7 | {"_id":{"$oid":"58f17cdccd1e7a06a857a9d3"},"tit":"RubyMine 2017.1.2 EAP 发布:改进 Puppet 模块的检测","con":"RubyMine 是一个全新的为 Ruby 和 Rails 开发者准备的 IDE (非开源且收费),RubyMine 由 JetBrains 开发(JetBrains最著名的产品之一就是 Java IDE:IntellJ IDEA了!)。RubyMine 是建立在 IntellJ IDEA 平台之上,提供所有必须的 IDE 功能,比如编辑,调试工具,源代码控制集成,代码自动提示完成,以及其他功能。专门为 Ruby 打造的功能有基于 GUI 支持的 RSpec 和 Test::Unit。主要更新内容如下:\r\n\r\nPuppet 改进:\r\n\r\n许多人抱怨更新到v2017.1后,Puppet停止支持他们2016.3.*版本的工作,这使得用户降级到以前的版本。这个EAP会解决这些问题:使用此EAP RubyMine可以从environment.conf读取modulepath。但请注意,您应该在正在处理的项目中使用environment.conf,否则RubyMine将无法检测到它。"} 8 | {"_id":{"$oid":"58f17d01cd1e7a06a857a9d4"},"tit":"微软收购 Deis,布局容器,意在抢夺开发者!","con":"Deis,一家被评价处于容器浪潮中心的公司,是一家开源PaaS厂商。致力于解放开发者和运营者,Deis让Kubernetes上的应用创建和管理更加简易。\r\n\r\nDeis提供管理Kubernetes部署环境的三种核心开源工具:Workflow,该平台供开发人员和运维团队轻松地部署和管理容器化应用程序;Helm,Kubernetes软件包管理器;Steward,Kubernetes原生服务代理(让应用程序可以彼此对话)。与很多公司一样,Deis的盈利也有赖于为这些应用程序提供收费的支持和培训。"} 9 | {"_id":{"$oid":"58f17d2ccd1e7a06a857a9d5"},"tit":"EverVim 20170413 发布,适合所有开发者的 Vim 发行版","con":"EverVim 20170413 发布了。版本发布仅为公布更新日志,安装时请仍使用Git Master。\r\n\r\n本次更新日志:\r\n\r\n通用\r\n\r\n新增了实验性的 WIndows 安装脚本\r\n\r\n打开文件后光标将恢复到上次编辑的位置并纵向居中\r\n\r\nGUI\r\n\r\n优化 NeoVim-Qt 字体配置\r\n\r\n暂时取消对 NeoVim-gtk 的支持,该项目仍处于不稳定开发状态\r\n\r\nVimR 和 MacVim 支持\r\n\r\n安卓系统运行 EverVim 默认禁用文件类型图标(因为目前只有极少终端模拟器支持自定义字体)\r\n\r\n外观\r\n\r\nIndentLine 缩进指示线改为完全连续的淡绿色竖直实线,如果是按Tab缩进,将会显示为白色实线(由默认的Knack NF字体支持)\r\n\r\n支持混合行号模式(通过变量g:evervim_hybrid_linenumber打开,将在当前行显示实际行数,其他行采用相对行数)"} 10 | {"_id":{"$oid":"58f17d65cd1e7a06a857a9d6"},"tit":"院士倪光南:Win 10 不安全 中国必须用自主操作系统","con":"对于发展自主国产操作系统,工程院院士倪光南再次奔走呼号。\r\n\r\n据媒体报道,在今天召开的“2017中国通信行业物联网大会”上,倪光南再次重申,Windows 10不列入政府采购项目是例证。\r\n\r\n他强调,我国并不是没有能力去开发操作系统,去做通用CPU,大型企业养几百个软件工程师没有问题,但是如果没有市场是不可能成功的。中国如果不抓住机遇,终端操作系统就没机会做了。在他看来,安全评估是非常重要的,以前是三个原则:保密性、完整性、可用性。现在需要与时俱进,增加可控性。\r\n\r\n倪光南表示,我国是个网络大国,但不是网络强国,核心技术受制于人是我们最大的隐患,而且不要指望能够买到核心技术。\r\n\r\n他介绍,全球大型软件厂商,除了德国的SAP以外,其余都是美国,美国才是真正的网络强国,核心技术在国外,不管规模有多大,也没有用。"} 11 | {"_id":{"$oid":"58f17d87cd1e7a06a857a9d7"},"tit":"CoffeeScript 2.0.0-alpha1 发布,脚本语言","con":"CoffeeScript 1.12.5 发布了。CoffeeScript这一门编程语言构建在JavaScript之上,其被编译成高效的JavaScript,这样你就可以在web浏览器上运行它,或是通过诸如用于服务器端应用的Node.js一类的技术来使用它。编译过程通常都很简单,产生出来的JavaScript与许多的最佳做法都保持了一致。"} 12 | {"_id":{"$oid":"58f17dd3cd1e7a06a857a9d8"},"tit":"开源项目哪家强?硅谷风投最火的 25 个开源项目排名","con":"当今很多最新最热面向企业的技术核心都是免费“开源”的技术。于是很多大公司,从金融巨头到零售也到服务公司,都把他们的业务围绕着全新的,基于社区的技术,这些技术与过去的IT实践的天壤之别。\r\n\r\n不过企业客户和投资者们要如何评估这些开源项目呢?他们如何分别哪些项目(通常有这奇怪的名字:Ansible,Vagrant,Gradle)能产生最多的用户使用趋势?哪些被最多的软件开发者追捧,哪些又有最多的市场份额潜力?"} 13 | {"_id":{"$oid":"58f17df1cd1e7a06a857a9d9"},"tit":"OSChina 周五乱弹 ——爸妈是真爱,你只是意外","con":"@您的好友 :没这么可爱。\r\n\r\n@马丁的代码 :没这么有气质。\r\n\r\n单身狗,安全啊!\r\n\r\n不出轨。\r\n\r\n@两江总督首席码农 :啊-此情此景,。。我想吟诗一首啊。淫来:鲁豫大姐真给力,娱乐圈里一片绿,一片绿啊偏绿,百合戳人小弟弟。\r\n\r\n你怎么说人家百合戳人小弟弟呢!\r\n\r\n百合不乐意了,"} 14 | {"_id":{"$oid":"58f17e0fcd1e7a06a857a9da"},"tit":"我是如何用 10 天自学编程,改变一生的?","con":"我是我,一个因兴趣入行的商学院毕业的程序员。最近有不少人,来问我,想学编程,但是又不知怎么开始。所以,我想把我8年前影响我一生的10天自学编程的经历,毫无保留的分享出来。\r\n\r\n如果看到这标题,会让你觉得,读完一篇文章就能快速的掌握编程技术的话,这可能会让你失望,这里甚至没有一行代码。\r\n\r\n我想分享的,是我最初自学编程的经历和心法。"} 15 | {"_id":{"$oid":"58f17e58cd1e7a06a857a9db"},"tit":"微软正式封杀 7 代酷睿、Ryzen 运行 Win7!补丁断更","con":"微软已经多次强调,不会对执意使用Windows 7/8.1的新硬件平台进行支持,涉及AMD、Intel、NVIDIA、高通等。\r\n\r\n其实主要就是指7代酷睿、200系芯片组、Ryzen、骁龙820/835这些,用意就是迫使用户尽快升级到Windows 10操作系统,而且最好是最新版。\r\n\r\n不过,虽然面对着酷睿核显、主板USB3.0没Win7驱动等安装困难,还有民间大神还是想出方法克服,从而“曲线救国”。\r\n\r\n然而,微软现在正式对这小搓用户弹窗提醒,警告他们的系统将无法获得安全更新,目前已知受到波及的有Kaby Lake、Ryzen以及少部分Skylake处理器。"} 16 | -------------------------------------------------------------------------------- /public/stylesheets/login_css.css: -------------------------------------------------------------------------------- 1 | html { 2 | font-size: 16px; 3 | -moz-osx-font-smoothing: grayscale; 4 | -webkit-font-smoothing: antialiased; 5 | -moz-text-size-adjust: 100%; 6 | -ms-text-size-adjust: 100%; 7 | -webkit-text-size-adjust: 100%; 8 | } 9 | .sc{ 10 | position: relative; 11 | height: 100vh; 12 | min-height: 600px; 13 | background: url(../images/body-bg.png) center no-repeat fixed; 14 | background-size: cover; 15 | } 16 | body { 17 | font: 400 16px/1.618 'PingFang SC','Helvetica Neue','Microsoft YaHei UI','Microsoft YaHei','Noto Sans CJK SC',Sathu,EucrosiaUPC,sans-serif; 18 | } 19 | article, aside, details, figcaption, figure, footer, header, main, menu, nav, section, summary, svg { 20 | display: block; 21 | } 22 | *, :after, :before { 23 | box-sizing: border-box; 24 | } 25 | a { 26 | background-color: transparent; 27 | -webkit-text-decoration-skip: objects; 28 | text-decoration: none; 29 | outline: 0; 30 | } 31 | .home-header .logo { 32 | display: inline-block; 33 | width: 219px; 34 | height: 69px; 35 | margin: 5vh 0 4vh 130px; 36 | background: url(../images/logo-osc-white.png) no-repeat; 37 | } 38 | .home-wrapper { 39 | height: 64vh; 40 | } 41 | .vertical { 42 | -webkit-box-align: center; 43 | -webkit-align-items: center; 44 | -ms-grid-row-align: center; 45 | -ms-flex-align: center; 46 | align-items: center; 47 | } 48 | .box { 49 | display: -webkit-box; 50 | display: -webkit-flex; 51 | display: -ms-flexbox; 52 | display: flex; 53 | } 54 | .home-body-box, .login-body, .logon-body { 55 | position: relative; 56 | width: 685px; 57 | margin: auto; 58 | padding: 35px 30px; 59 | color: #666; 60 | border-radius: 4px; 61 | background: #fff; 62 | -webkit-box-shadow: 1px 1px 4px #767676; 63 | box-shadow: 1px 1px 4px #767676; 64 | } 65 | .login-body .login-tabs { 66 | position: absolute; 67 | top: 0; 68 | left: 0; 69 | display: inline-block; 70 | overflow: hidden; 71 | width: 93px; 72 | height: 93px; 73 | } 74 | .login-body .login-tabs .tab-item.active { 75 | display: inline-block; 76 | } 77 | .login-body .login-tabs .tab-item { 78 | position: absolute; 79 | z-index: 1; 80 | top: 13px; 81 | left: 13px; 82 | display: none; 83 | } 84 | .home-body-box .tab-item, .login-body .tab-item, .logon-body .tab-item { 85 | cursor: pointer; 86 | } 87 | .login-body .login-tabs .tab-item .ic-svg { 88 | width: 40px; 89 | height: 40px; 90 | } 91 | .ic-qw-white { 92 | background-image: url(https://www.oschina.net/dist/oschina/home/login/imgs/icon/ic-qw-white.svg); 93 | } 94 | .ic-svg { 95 | display: inline-block; 96 | width: 32px; 97 | height: 32px; 98 | background-repeat: no-repeat; 99 | background-position: center; 100 | background-size: contain; 101 | } 102 | .login-body .login-tabs .tab-bg { 103 | display: inline-block; 104 | width: 130px; 105 | height: 130px; 106 | margin: -65px 0 0 -65px; 107 | content: ''; 108 | -webkit-transform: rotate(45deg); 109 | -ms-transform: rotate(45deg); 110 | transform: rotate(45deg); 111 | background: #31b968; 112 | } 113 | .home-body-box .login-title, .login-body .login-title, .logon-body .login-title { 114 | font-size: 1.375rem; 115 | margin-bottom: 40px; 116 | } 117 | .text-center { 118 | text-align: center; 119 | } 120 | .box-aw { 121 | min-width: 0; 122 | -webkit-transition: width .2s; 123 | transition: width .2s; 124 | -ms-flex-order: 2; 125 | -webkit-order: 2; 126 | -webkit-box-ordinal-group: 3; 127 | order: 2; 128 | -webkit-box-flex: 1; 129 | -webkit-flex: 1; 130 | -ms-flex: 1; 131 | flex: 1; 132 | } 133 | form { 134 | display: block; 135 | margin-top: 0em; 136 | } 137 | .login-body .form-wrapper, .logon-body .form-wrapper { 138 | width: 300px; 139 | margin-right: 52px; 140 | margin-left: 38px; 141 | } 142 | .home-body-box .form-wrapper .form-item:not(:last-child), .login-body .form-wrapper .form-item:not(:last-child), .logon-body .form-wrapper .form-item:not(:last-child) { 143 | margin-bottom: 20px; 144 | } 145 | .home-body-box .form-wrapper .form-item, .login-body .form-wrapper .form-item, .logon-body .form-wrapper .form-item { 146 | position: relative; 147 | } 148 | .home-body-box input, .login-body input, .logon-body input { 149 | width: 81%; 150 | } 151 | button, input, select, textarea { 152 | font: inherit; 153 | margin: 0; 154 | outline: 0; 155 | } 156 | input:not([type=button]) { 157 | font-size: .875rem; 158 | line-height: 1.6; 159 | padding: 12px 20px; 160 | -webkit-transition: all .2s; 161 | transition: all .2s; 162 | color: #666; 163 | border: 1px solid #dce4e6; 164 | border-radius: 3px; 165 | outline: 0; 166 | background: #f3f6f8; 167 | } 168 | button, hr, input { 169 | overflow: visible; 170 | } 171 | .home-body-box .form-wrapper .form-item .form-tips, .login-body .form-wrapper .form-item .form-tips, .logon-body .form-wrapper .form-item .form-tips { 172 | position: absolute; 173 | top: 100%; 174 | } 175 | .home-body-box .form-wrapper .form-tips, .login-body .form-wrapper .form-tips, .logon-body .form-wrapper .form-tips { 176 | line-height: 20px; 177 | } 178 | .form-wrapper .form-tips { 179 | font-size: .75rem; 180 | color: #31b968; 181 | } 182 | #user{ 183 | display: inline-block; 184 | } 185 | .checkbox-group input { 186 | display: none; 187 | opacity: 0; 188 | } 189 | .checkbox-group input[type=checkbox]+label, .checkbox-group input[type=radio]+label { 190 | line-height: 1; 191 | position: relative; 192 | display: -webkit-box; 193 | display: -webkit-flex; 194 | display: -ms-flexbox; 195 | display: flex; 196 | cursor: pointer; 197 | -webkit-box-align: center; 198 | -webkit-align-items: center; 199 | -ms-flex-align: center; 200 | align-items: center; 201 | } 202 | .checkbox-group input[type=checkbox]:checked+label:before { 203 | content: '\2713'; 204 | background-color: #31b968; 205 | } 206 | .checkbox-group input[type=checkbox]:checked+label:before, .checkbox-group input[type=radio]:checked+label:before { 207 | text-align: center; 208 | color: #fff; 209 | border-color: #31b968; 210 | } 211 | .checkbox-group input[type=checkbox]+label:before { 212 | border-radius: 3px; 213 | } 214 | .checkbox-group input[type=checkbox]+label:before, .checkbox-group input[type=radio]+label:before { 215 | line-height: 1; 216 | display: inline-block; 217 | width: 18px; 218 | height: 18px; 219 | margin-right: 8px; 220 | content: ''; 221 | -webkit-transition: all .2s; 222 | transition: all .2s; 223 | color: #fff; 224 | border: 1px solid #dce4e6; 225 | background-color: #f3f6f8; 226 | } 227 | .box-fr { 228 | transition: width .2s; 229 | -ms-flex-order: 3; 230 | -webkit-order: 3; 231 | -webkit-box-ordinal-group: 4; 232 | order: 3; 233 | } 234 | .home-body-box .form-wrapper .form-button, .login-body .form-wrapper .form-button, .logon-body .form-wrapper .form-button { 235 | font-size: 1.25rem; 236 | } 237 | .btn a.block, .btn.block { 238 | display: block; 239 | width: 100%; 240 | } 241 | .btn-green { 242 | color: #fff; 243 | background: #31b968; 244 | } 245 | .btn-green:hover{ 246 | color: #fff; 247 | background: #31b948; 248 | } 249 | .btn, .btn a { 250 | padding: .4rem 1.2rem; 251 | cursor: pointer; 252 | -webkit-transition: all .2s; 253 | transition: all .2s; 254 | border: 1px solid transparent; 255 | border-radius: 2px; 256 | outline: 0; 257 | } 258 | .home-body-box .other-login-wrapper, .login-body .other-login-wrapper, .logon-body .other-login-wrapper { 259 | width: 220px; 260 | padding-left: 40px; 261 | border-left: 1px dashed #eee; 262 | } 263 | .home-body-box .other-login-wrapper .span-box, .login-body .other-login-wrapper .span-box, .logon-body .other-login-wrapper .span-box { 264 | display: block; 265 | } 266 | .span-box { 267 | display: inline-block; 268 | } 269 | .btn a.btn-lg, .btn.btn-lg { 270 | font-size: 1.125rem; 271 | } 272 | .btn-link, .btn-link a { 273 | padding: 0; 274 | color: #31b968; 275 | border: none; 276 | border-radius: 0; 277 | } 278 | .home-body-box .other-login-wrapper .other-login, .login-body .other-login-wrapper .other-login, .logon-body .other-login-wrapper .other-login { 279 | margin-top: 45px; 280 | } 281 | .biao{ 282 | margin-top: 10px; 283 | overflow: hidden; 284 | } 285 | .home-footer { 286 | font-size: .875rem; 287 | line-height: 2; 288 | position: absolute; 289 | bottom: 0; 290 | left: 0; 291 | width: 100%; 292 | margin: 5.5vh 0; 293 | text-align: center; 294 | color: #fff; 295 | } 296 | .home-footer a:not([class]) { 297 | color: #fff; 298 | } 299 | .se{ 300 | position: relative; 301 | height: 100vh; 302 | min-height: 600px; 303 | background: url(../images/re_bg.jpg) center no-repeat fixed; 304 | background-size: cover; 305 | } 306 | .bt_re{ 307 | margin-top: 40px; 308 | } 309 | -------------------------------------------------------------------------------- /public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | a { 2 | -webkit-transition: color .3s; 3 | transition: color .3s; 4 | text-decoration: none; 5 | color: #333; 6 | border: none; 7 | outline: none; 8 | } 9 | .fcolor{ 10 | color: #FFAAAA; 11 | } 12 | .header-navbar { 13 | min-height: 40px; 14 | } 15 | .layout-flex { 16 | display: -webkit-box; 17 | display: -ms-flexbox; 18 | display: flex; 19 | -webkit-box-align: center; 20 | -ms-flex-align: center; 21 | align-items: center; 22 | } 23 | .header-navbar .top-banner { 24 | background: -webkit-linear-gradient(left, rgba(78, 170, 76, 0.5), rgba(0, 202, 133, 0.5)), #4eaa4c; 25 | background: linear-gradient(to right, rgba(78, 170, 76, 0.5), rgba(0, 202, 133, 0.5)), #4eaa4c; 26 | color: #fff; 27 | height: 40px; 28 | line-height: 40px; 29 | padding: 0 20px; 30 | font-size: 14px; 31 | } 32 | *, *:before, *:after { 33 | box-sizing: inherit; 34 | -webkit-tap-highlight-color: transparent; 35 | } 36 | .layout-flex .flex-grow { 37 | -webkit-box-flex: 1; 38 | -ms-flex-positive: 1; 39 | flex-grow: 1; 40 | } 41 | input, button, a, textarea { 42 | font-family: "Pingfang SC", "STHeiti", "Lantinghei SC", "Open Sans", Arial, "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", SimSun, sans-serif; 43 | border: none; 44 | outline: 0; 45 | } 46 | .header-navbar .top-banner a { 47 | color: #fff; 48 | } 49 | .header-navbar .top-banner .osc-logo { 50 | width: 24px; 51 | height: 24px; 52 | display: inline-block; 53 | vertical-align: middle; 54 | margin-right: 20px; 55 | background: url(https://my.oschina.net/build/www/imgs/logo-osc.svg) no-repeat; 56 | } 57 | @media screen and (min-width: 769px){ 58 | .sm-hide { 59 | display: inline-block; 60 | } 61 | } 62 | .header-navbar .top-banner .menus .menu-item { 63 | display: inline-block; 64 | margin-right: 12px; 65 | } 66 | .btn-success{ 67 | border-color: #30b762; 68 | background: #30b762; 69 | } 70 | .osc-banner { 71 | height: 110px; 72 | background-image: url(../images/header-bg.jpg); 73 | } 74 | .vertical { 75 | -webkit-box-align: center; 76 | -webkit-align-items: center; 77 | -ms-grid-row-align: center; 78 | -ms-flex-align: center; 79 | align-items: center; 80 | } 81 | .box { 82 | display: -webkit-box; 83 | display: -webkit-flex; 84 | display: -ms-flexbox; 85 | display: flex; 86 | } 87 | .sec-header { 88 | height: 70px; 89 | background-repeat: no-repeat; 90 | background-position: center; 91 | background-size: cover; 92 | } 93 | .sec-header .banner-box { 94 | width: 100%; 95 | max-width: 1200px; 96 | height: 56px; 97 | margin: auto; 98 | } 99 | .box-fl { 100 | -webkit-transition: width .2s; 101 | transition: width .2s; 102 | -ms-flex-order: 1; 103 | -webkit-order: 1; 104 | -webkit-box-ordinal-group: 2; 105 | order: 1; 106 | } 107 | .box-aw { 108 | min-width: 0; 109 | -webkit-transition: width .2s; 110 | transition: width .2s; 111 | -ms-flex-order: 2; 112 | -webkit-order: 2; 113 | -webkit-box-ordinal-group: 3; 114 | order: 2; 115 | -webkit-box-flex: 1; 116 | -webkit-flex: 1; 117 | -ms-flex: 1; 118 | flex: 1; 119 | margin-left: 20px; 120 | } 121 | .osc-banner .osc-banner-nav { 122 | width: 33%; 123 | } 124 | article, aside, details, figcaption, figure, footer, header, main, menu, nav, section, summary { 125 | display: block; 126 | } 127 | .osc-banner .osc-bnav-wrapper { 128 | margin: 0 auto; 129 | } 130 | .box.around { 131 | -webkit-justify-content: space-around; 132 | -ms-flex-pack: distribute; 133 | justify-content: space-around; 134 | } 135 | .osc-banner .banner-link.site { 136 | font-size: 18px; 137 | color: #000; 138 | font-weight: bold; 139 | margin: 0 20px 0 0; 140 | } 141 | .osc-banner .banner-link { 142 | font-size: 14px; 143 | color: #4A4A4A; 144 | transition: color .2s; 145 | } 146 | .box.column { 147 | flex-direction: column; 148 | -ms-flex-direction: column; 149 | -webkit-flex-direction: column; 150 | -moz-box-orient: vertical; 151 | -webkit-box-orient: vertical; 152 | -moz-box-direction: normal; 153 | -webkit-box-direction: normal; 154 | } 155 | .osc-banner .banner-link { 156 | font-size: 14px; 157 | color: #4A4A4A; 158 | transition: color .2s; 159 | } 160 | .box-fr { 161 | -webkit-transition: width .2s; 162 | transition: width .2s; 163 | -ms-flex-order: 3; 164 | -webkit-order: 3; 165 | -webkit-box-ordinal-group: 4; 166 | order: 3; 167 | } 168 | .sec-header .sec-search { 169 | position: relative; 170 | margin: 0; 171 | } 172 | button, input { 173 | overflow: visible; 174 | } 175 | button, input, select, textarea { 176 | font: inherit; 177 | margin: 0; 178 | outline: none; 179 | } 180 | .sec-header .sec-search .search-text { 181 | font-size: .875rem; 182 | width: 280px; 183 | height: 30px; 184 | padding: 0 50px 0 14px; 185 | color: #111; 186 | border: none; 187 | border-radius: 1.5em; 188 | outline: none; 189 | background: rgba(255,255,255,0.6); 190 | -webkit-box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1); 191 | box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1); 192 | -webkit-transition: -webkit-box-shadow .2s; 193 | transition: -webkit-box-shadow .2s; 194 | transition: box-shadow .2s; 195 | transition: box-shadow .2s, -webkit-box-shadow .2s; 196 | } 197 | .sec-header .sec-search .ic-search { 198 | position: absolute; 199 | top: 0; 200 | right: 0; 201 | width: 40px; 202 | height: 30px; 203 | padding: 0; 204 | cursor: pointer; 205 | border: none; 206 | border-top-right-radius: 1em; 207 | border-bottom-right-radius: 1em; 208 | outline: none; 209 | background: transparent url(https://www.oschina.net/build/oschina/components/imgs/icon/ic_search.svg) no-repeat center center; 210 | background-size: 16px 16px; 211 | -webkit-transition: background .2s; 212 | transition: background .2s; 213 | } 214 | .sc-container { 215 | width: 100%; 216 | max-width: 1200px; 217 | margin: 0 auto; 218 | } 219 | .box.justify { 220 | -webkit-justify-content: space-between; 221 | justify-content: space-between; 222 | -ms-flex-pack: justify; 223 | -moz-box-pack: justify; 224 | -webkit-box-pack: justify; 225 | } 226 | .news-container .col-of-news { 227 | width: 800px; 228 | } 229 | .news-container{ 230 | width: 800px; 231 | } 232 | .information{ 233 | font-weight: bold; 234 | font-size: 16px; 235 | position: relative; 236 | } 237 | .information:before { 238 | position: absolute; 239 | content: ''; 240 | display: block; 241 | width: 3px; 242 | left: -16px; 243 | top: 50%; 244 | margin-top: -12px; 245 | height: 24px; 246 | background: #21B351; 247 | } 248 | .page .news { 249 | height: 26px; 250 | line-height: 26px; 251 | justify-content: space-between; 252 | margin-top: 20px; 253 | } 254 | .page .news .news-link { 255 | position: relative; 256 | font-size: 20px; 257 | color: #647891; 258 | padding: 0 0 0 13px; 259 | transition: color .2s; 260 | } 261 | .page .news .news-link.is-today { 262 | color: #022856; 263 | white-space: nowrap; 264 | overflow: hidden; 265 | text-overflow: ellipsis; 266 | max-width: 650px; 267 | } 268 | .page .news .news-link.is-today:before { 269 | background: #7ED321; 270 | } 271 | .page .news .news-link:before { 272 | position: absolute; 273 | display: block; 274 | content: ''; 275 | left: 0; 276 | top: 50%; 277 | margin-top: -2px; 278 | width: 5px; 279 | height: 5px; 280 | border-radius: 50%; 281 | background: #CFCFCF; 282 | } 283 | .page .news .news-date { 284 | font-size: 20px; 285 | color: #AAA; 286 | } 287 | .content-header { 288 | height: 30px; 289 | box-shadow: inset 0 -1px 0 0 #D8D8D8; 290 | margin: 20px 0 12px 0; 291 | } 292 | .page .news .news-link.is-today:hover{ 293 | color: #4990e2; 294 | text-decoration: none; 295 | } 296 | .aside-container { 297 | margin: 20px 0 0 10px; 298 | overflow: hidden; 299 | flex: 0.5; 300 | } 301 | .form-control{ 302 | height: 20px; 303 | } 304 | textarea.form-control { 305 | height: auto; 306 | resize: vertical; 307 | } 308 | .form-tips{ 309 | color: #f00; 310 | font-size: 20px; 311 | } 312 | -------------------------------------------------------------------------------- /routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | var mongodb=require('mongodb').MongoClient; 4 | //数据库地址 5 | var db_str='mongodb://localhost:27017/picture' 6 | /* GET home page. */ 7 | router.get('/', function(req, res, next) { 8 | //链接数据库 9 | mongodb.connect(db_str,function(err,db) { 10 | if(err){ 11 | console.log(err); 12 | }else{ 13 | //调用finddata函数 14 | finddata(db) 15 | //关闭数据库 16 | db.close() 17 | } 18 | }) 19 | //查找函数 20 | var finddata=function(db) { 21 | //找到要查找的集合 22 | var coll=db.collection('news') 23 | var coll1=db.collection('message') 24 | var bian=0 25 | coll1.find({}).toArray(function(err,litem1) { 26 | if(!err){ 27 | bian=litem1 28 | } 29 | }) 30 | 31 | coll.find({}).toArray(function(err,litem) { 32 | if(!err){ 33 | res.render('index', {user:req.session.user,litem:litem,bian:bian,tip:''}); 34 | } 35 | }) 36 | 37 | } 38 | }); 39 | 40 | router.post('/', function(req, res, next) { 41 | 42 | //获取留言数据 43 | var tit=req.body['tit'] 44 | var con=req.body['con'] 45 | if (req.session.user) { 46 | //链接数据库 47 | mongodb.connect(db_str,function(err,db) { 48 | if(err){ 49 | console.log(err); 50 | }else{ 51 | //调用插入函数 52 | insertdata(db,function(result) { 53 | res.redirect('/'); 54 | db.close() 55 | }) 56 | 57 | } 58 | }) 59 | }else{ 60 | //链接数据库 61 | mongodb.connect(db_str,function(err,db) { 62 | if(err){ 63 | console.log(err); 64 | }else{ 65 | //调用finddata函数 66 | finddata(db) 67 | //关闭数据库 68 | db.close() 69 | } 70 | }) 71 | //查找函数 72 | var finddata=function(db) { 73 | //找到要查找的集合 74 | var coll=db.collection('news') 75 | var coll1=db.collection('message') 76 | var bian=0 77 | coll1.find({}).toArray(function(err,litem1) { 78 | if(!err){ 79 | bian=litem1 80 | } 81 | }) 82 | 83 | coll.find({}).toArray(function(err,litem) { 84 | if(!err){ 85 | res.render('index',{user:req.session.user,litem:litem,bian:bian,tip:'
请先登录在留言
'}); 86 | } 87 | }) 88 | } 89 | } 90 | 91 | //插入函数 92 | var insertdata=function(db,callback) { 93 | //找到要插入的集合 94 | var coll=db.collection('message') 95 | //设置需要插入集合的文档数据 96 | var data=[{tit:tit,con:con}] 97 | coll.insert(data,function(err,result) { 98 | if(err){ 99 | console.log(err) 100 | }else{ 101 | callback(result) 102 | } 103 | }) 104 | } 105 | }); 106 | 107 | router.get('/register', function(req, res, next) { 108 | res.render("register",{num:""}) 109 | }); 110 | 111 | router.get('/showlist', function(req, res, next) { 112 | 113 | 114 | //链接数据库 115 | mongodb.connect(db_str,function(err,db) { 116 | if(err){ 117 | console.log(err); 118 | }else{ 119 | //调用finddata函数 120 | finddata(db) 121 | //关闭数据库 122 | db.close() 123 | } 124 | }) 125 | //查找函数 126 | var finddata=function(db) { 127 | //找到要查找的集合 128 | var coll=db.collection('news') 129 | //设置需要查找集合的文档数据 130 | var ooo=req.query.id 131 | 132 | coll.find({}).toArray(function(err,litem) { 133 | if(!err){ 134 | litem.forEach(function(cen,index) { 135 | if(cen["_id"]==req.query.id){ 136 | res.render("showlist",{con:cen["con"],tit:cen["tit"],user:req.session.user}) 137 | } 138 | }) 139 | } 140 | }) 141 | } 142 | }); 143 | 144 | 145 | module.exports = router; 146 | -------------------------------------------------------------------------------- /routes/users.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | //mongo服务 4 | var mongodb=require('mongodb').MongoClient; 5 | //数据库地址 6 | var db_str='mongodb://localhost:27017/picture' 7 | 8 | /* GET users listing. */ 9 | router.get('/', function(req, res, next) { 10 | res.render('register', {num:""}); 11 | }); 12 | 13 | router.get('/login', function(req, res, next) { 14 | res.render('login', {num:''}); 15 | }); 16 | 17 | router.get('/quit', function(req, res, next) { 18 | req.session.user=undefined 19 | res.redirect('/') 20 | }); 21 | 22 | //router.get('/liuyan', function(req, res, next) { 23 | // //链接数据库 24 | // mongodb.connect(db_str,function(err,db) { 25 | // if(err){ 26 | // console.log(err); 27 | // }else{ 28 | // //调用finddata函数 29 | // finddata(db) 30 | // //关闭数据库 31 | // db.close() 32 | // } 33 | // }) 34 | // //查找函数 35 | // var finddata=function(db) { 36 | // //找到要查找的集合 37 | // var coll=db.collection('message') 38 | // coll.find({}).toArray(function(err,litem) { 39 | // if(!err){ 40 | // res.render('showlist', {litem:litem}); 41 | // } 42 | // }) 43 | // } 44 | //}); 45 | 46 | 47 | 48 | //注册 49 | router.post('/register', function(req, res, next) { 50 | //获取表单数据 51 | var user=req.body['user'] 52 | var pass=req.body['pwd'] 53 | //链接数据库 54 | mongodb.connect(db_str,function(err,db) { 55 | if(err){ 56 | console.log(err); 57 | }else{ 58 | //调用插入函数 59 | if(user&&pass){ 60 | insertdata(db,function(result) { 61 | res.redirect('/users/login'); 62 | db.close() 63 | }) 64 | }else{ 65 | res.redirect('/register'); 66 | db.close() 67 | } 68 | } 69 | }) 70 | //插入函数 71 | var insertdata=function(db,callback) { 72 | //找到要插入的集合 73 | var coll=db.collection('login') 74 | //设置需要插入集合的文档数据 75 | var data=[{user:user,pass:pass}] 76 | coll.insert(data,function(err,result) { 77 | if(err){ 78 | console.log(err) 79 | }else{ 80 | callback(result) 81 | } 82 | }) 83 | } 84 | }); 85 | 86 | //登录 87 | router.post('/login', function(req, res, next) { 88 | //获取表单数据 89 | var user=req.body['user'] 90 | var pass=req.body['pwd'] 91 | //链接数据库 92 | mongodb.connect(db_str,function(err,db) { 93 | if(err){ 94 | console.log(err); 95 | }else{ 96 | //调用finddata函数 97 | finddata(db) 98 | //关闭数据库 99 | db.close() 100 | } 101 | }) 102 | //查找函数 103 | var finddata=function(db) { 104 | //找到要查找的集合 105 | var coll=db.collection('login') 106 | //设置需要查找集合的文档数据 107 | var data={user:user,pass:pass} 108 | coll.find(data).toArray(function(err,litem) { 109 | if(!err){ 110 | if (litem.length) { 111 | req.session.user=litem[0].user 112 | res.redirect('/'); 113 | }else{ 114 | res.render('login', {num:'
请输入正确的用户名和密码
',}); 115 | } 116 | } 117 | }) 118 | } 119 | }); 120 | 121 | //留言 122 | //router.post('/liuyan', function(req, res, next) { 123 | // 124 | // //获取留言数据 125 | // var tit=req.body['tit'] 126 | // var con=req.body['con'] 127 | // if (req.session.user) { 128 | // //链接数据库 129 | // mongodb.connect(db_str,function(err,db) { 130 | // if(err){ 131 | // console.log(err); 132 | // }else{ 133 | // //调用插入函数 134 | // insertdata(db,function(result) { 135 | // res.redirect('/users/liuyan'); 136 | // db.close() 137 | // }) 138 | // 139 | // } 140 | // }) 141 | // }else{ 142 | // res.send('失败!!!!!!'); 143 | // } 144 | // 145 | // //插入函数 146 | // var insertdata=function(db,callback) { 147 | // //找到要插入的集合 148 | // var coll=db.collection('message') 149 | // //设置需要插入集合的文档数据 150 | // var data=[{tit:tit,con:con}] 151 | // coll.insert(data,function(err,result) { 152 | // if(err){ 153 | // console.log(err) 154 | // }else{ 155 | // callback(result) 156 | // } 157 | // }) 158 | // } 159 | //}); 160 | 161 | module.exports = router; 162 | -------------------------------------------------------------------------------- /views/error.ejs: -------------------------------------------------------------------------------- 1 |

<%= message %>

2 |

<%= error.status %>

3 |
<%= error.stack %>
4 | -------------------------------------------------------------------------------- /views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |
11 |
12 | 13 | 16 |
17 |
18 | 28 |
29 |
30 |
31 |
32 |
33 | 85 |
86 |
87 | 88 |
89 |
90 |
91 |
92 |
93 | 综合资讯 94 |
95 |
96 | <% litem.forEach(function(cen,index){ %> 97 |
98 | <%= cen.tit %> 99 | <%= "0"+(new Date().getMonth()+1)+"/"+new Date().getDate() %> 100 |
101 | <% }) %> 102 |
103 | 104 |
105 |
106 |
107 | 149 |
150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /views/login.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 |
12 |
13 | 89 |
90 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /views/register.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 |
12 |
13 | 78 |
79 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /views/showlist.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 |
13 | 14 | 17 |
18 |
19 | 29 |
30 |
31 |
32 |
33 |
34 | 86 |
87 |
88 |

<%- tit %>

89 |
<%- con %>
90 | 91 | 92 |
93 | 94 |
95 | 96 | 97 | --------------------------------------------------------------------------------