47 Express框架开发
项目开发流程
1、初始化 npm init -y
2、下载你已知包 npm i express
3、创建入口文件app.js ( main.js )
4、搭建express服务器基本框架(引包、开端口)
5、定义路由
6、在路由书写自己的业务了(难点)
中间件种类
应用级别的中间件
app.get/app.post
app.method的语法都可以简单称为中间件
错误中间件
特点:写后面。中间件和路由是有前后顺序的。所以错误中间件写后面。
404错误:
express默认支持404,但...
1, 在schema 目录创建 users.js 文件,通过 mongoose 模块来操作数据库
2, 在定义 users 表结构之前,需要让应用支持或连接数据库 。 所以要在应用的入口文件 app.js 中 进行数据库的重放(即加载数据库)
3 , var mongoose = require(‘mongoose‘)
4 , mongoose.connect() //连接数据库 。
5 , 在连接之前需要开启数据库 ,(1) cmd 进入 E:\MongoDB\Server\4.0\bin 目录下 E:\MongoDB\Server\4.0...
首先我们看看API以及官网教程:
https://plotly.com/python-api-reference/plotly.express.html
https://plotly.com/python/plotly-express/
express基本使用
一、express基本使用1、导入express2、获取请求信息3、获取响应信息4、设置响应头5、设置响应码6、匹配任何请求一、express基本使用
1、导入express
第一种方法
require('./init');
const express = require('express');
const http = require('http');
const app = express(); //创建一个express应用
// app实际上是一个函数,用于处理请求的函数
const server = http.createServer(app);
const port = 5008;
ser...
0. To install bower , run the following command in webstorm terminal(alt+f12) npm install bower bower install jquery bower init 1. add following linew to app.jsapp.use(express.static(__dirname + ‘/public‘)); app.use(‘/bower_components‘, express.static(__dirname + ‘/bower_components‘)); 2.add flowing line to your page<script src="/bower_components/jquery/dist/jquery.js" type="text/...