上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 39 下一页
摘要: 一,安装 : npm install body-parser 二,加载 : var bodyParser = require('body-parser') 三,配置 : https://github.com/expressjs/body-parser 调用 bodyParser.urlencoded 阅读全文
posted @ 2019-06-08 16:59 武卡卡 阅读(808) 评论(0) 推荐(0) 编辑
摘要: 一,前端页面 /views/login.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-sca 阅读全文
posted @ 2019-06-08 11:36 武卡卡 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 1, 在schema 目录创建 users.js 文件,通过 mongoose 模块来操作数据库 2, 在定义 users 表结构之前,需要让应用支持或连接数据库 。 所以要在应用的入口文件 app.js 中 进行数据库的重放(即加载数据库) 3 , var mongoose = require(' 阅读全文
posted @ 2019-06-07 14:08 武卡卡 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 一,根据功能进行模块划分 1,前台模块 2,后台管理模块 3,API模块 二,使用 app.use() 进行模块划分 1,app.use('/',require('./router/main')) 1,app.use('/admin',require('./router/admin')) 1,app 阅读全文
posted @ 2019-06-06 22:43 武卡卡 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 静态资源文件处理 (一)设置静态资源托管目录 /* * 当 用户访问的 url 以 /public 开始 ,那么直接返回对应 __dirname + '/public' 下的文件 。 注意是双下划线 __ */ app.use('/public',express.static(__dirname+' 阅读全文
posted @ 2019-06-05 22:15 武卡卡 阅读(321) 评论(3) 推荐(1) 编辑
摘要: 一,创建应用 (一),创建应用,监听端口 var express = require('express') // 创建app应用 var app = express() app.listen(3000) (二),用户的访问 1,用户可以通过 url 访问 web应用 2,web 后端通过用户访问的 阅读全文
posted @ 2019-06-05 16:27 武卡卡 阅读(505) 评论(0) 推荐(0) 编辑
摘要: 一,初始化 二,安装第三方模块express 三,安装中间件 1,bodyParser : 解析 post 请求数据 2,cookies : 读写 cookie 3,swig :模板解析引擎 4,mongoose : 操作 mongodb 数据 5,markdown : markdown语法解析生成 阅读全文
posted @ 2019-06-05 16:08 武卡卡 阅读(236) 评论(0) 推荐(0) 编辑
摘要: var http = require("http"); var url = require("url"); var fs = require("fs"); var path = require("path"); http.createServer(function(req,res){ //得到用户的 阅读全文
posted @ 2019-06-05 08:26 武卡卡 阅读(536) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-06-01 22:07 武卡卡 阅读(104) 评论(0) 推荐(0) 编辑
摘要: ECMAScript 对于不同的环境(运行平台),设计结构,理念,使用方式大相径庭。 1,浏览器 :DOM BOM 2,NodeJS :FS,HTTP 内置模块 ; 第三方模块 ; 内置模块 3,桌面级应用及其他平台 : Window Mac 系统 及 其他操作平台 一,CommonJS 规范的由来 阅读全文
posted @ 2019-06-01 19:33 武卡卡 阅读(324) 评论(0) 推荐(0) 编辑
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 39 下一页