文件名称:nodeAuth.zip
文件大小:25.63MB
文件格式:ZIP
更新时间:2023-04-24 10:34:11
nodejs 实现用户登录权限校
// 依赖 var express = require('express'); // let path = require('path') // const proxy = require('express-http-proxy'); var request = require('request'); var log4js = require('log4js'); // var fs = require('fs'); var cookieParser = require("cookie-parser"); // var ejs = require('ejs'); log4js.configure('./log4js.json'); const logger = log4js.getLogger(); // 加载路由控制 // var users = require('./routes/users'); // 第三方接口url const baseUrl = 'http://127.0.0.1:8080/service/rest/'; var app = express(); app.set('view engine','ejs'); // 打印日志 app.use(log4js.connectLogger(logger || log4js.getLogger('default'), { format: '[:remote-addr :method :url :status :response-timems][:referrer HTTP/:http-version :user-agent]'//自定义输出格式 })); app.use(cookieParser());