发布错误 – Node.JS(有效载荷)
今天,当我的服务器(本地)与一个base64图像需要一个职位正在返回此错误:前端正在使用AngularJS后端使用MongoDB,Node.JS,Mongoose和NodeRestFULL
面前
错误后端
在这里我的server.js
const express = require('express') const server = express(); //transform params to int const queryParser = require('express-query-int') //const allowCors = require('./cors') server.use(function(req,res,next){ res.header('Access-Control-Allow-Origin','*') res.header('Access-Control-Allow-Methods','GET,POST,OPTIONS,PUT,PATCH,DELETE') res.header('Access-Control-Allow-Headers','Origin, X-Requested-With, Content-Type, Accept') res.header('Access-Control-Allow-Credentials', true); next() }) server.use(queryParser()) server.use(bodyParse.text({type:'*/*'})) server.use(bodyParse.urlencoded({limit: '50mb', extended: true})) server.use(bodyParse.json({type:'json/*', limit: '50mb'})) //server.use(bodyParse.urlencoded({limit: '50mb'})); server.listen(port, function(){ console.log(`BACKEND está rodando na porta ${port}`) }) module.exports = server
loader.js
const server = require('./config/server') require('./config/database') require('./config/routes')(server)
在这里,我的模式mongodb
const restful = require('node-restful') const mongoose = restful.mongoose //Schema para os comprovantes const reciboProventoSchema = new mongoose.Schema({ name: { type: String, required: true}, month: { type: String, required: true}, description: { type: String, required: true}, imgBase: {type: String, required: true} }) module.exports = restful.model('BillsPaysProv', reciboProventoSchema)
在这里,我将提供基本的服务
//Import schemas const BillsPaysProv = require('./billsProv') //Create service to post a mensage contact BillsPaysProv.methods(['get','put','post','delete']) BillsPaysProv.updateOptions({new: true, runValidators: true}) module.exports = BillsPaysProv
- 有没有人创build了一个运行在IISNode下的Node.js,Angular2应用程序?
- 量angular器networking驱动程序与Linux上的selenium
- Angular 4+ Express不是从Heroku开始的
- Angular 2的http请求在新系统上处于挂起/取消状态
- eventEmitter侦听器和具有不同参数的发射器
- Nodejs Firebase和Angular4authentication
- 在Azure上部署Angular2应用程序时发生节点版本错误
- 如何查看在Angular中声明的node_modules的非缩小的源文件
- 在Angular 2应用程序中使用本地npm仓库中的组件