express

Getting Apache to allow access to Express API over HTTPS

倾然丶 夕夏残阳落幕 提交于 2020-06-18 06:52:49
问题 My website (https://www.tjbrackett.com/contact), which is on Apache, cannot access my Express app that is on the same server over HTTPS. Before I added an SSL certificate to the site, the setup ran perfectly. When I revert the SSL cert, it works again. The error I'm receiving on the front-end is ERR_CERT_AUTHORITY_INVALID. I've tried setting up a proxy/reverse proxy. I'm not sure if I set them up correctly. I've done a self-signed SSL cert on the Express app. I've tried to serve the Express

How to set up VueJS routes and NodeJS Express API routes? [duplicate]

浪子不回头ぞ 提交于 2020-06-17 15:57:08
问题 This question already has answers here : Serving VueJS Builds via Express.js using history mode (2 answers) Closed yesterday . API routes return always HTML never JSON - I have tried a lot of different solutions but none of them worked. Here is the current setup: // server.js const express = require("express"); const app = express(); const history = require("connect-history-api-fallback"); const cors = require("cors"); const bodyParser = require("body-parser"); const path = require("path");

In Swagger openapi v3.0.0, facing issue in multiple file uploads

空扰寡人 提交于 2020-06-17 15:30:48
问题 Trying to upload multiple files in swagger api. While uploading single file with files: type: string format: binary Getting file in req.files , but when trying for multiple files with files: type: array items: type: string format: binary req.files = null and there is files: '[object file],[object file]' in req.body using nodejs with express 回答1: Uploading an array of files is supported in Swagger UI 3.26.0+ and Swagger Editor 3.10.0+. You need to upgrade your Swagger UI to the latest version.

Why Chrome can’t set cookie

只谈情不闲聊 提交于 2020-06-17 09:14:54
问题 I have a response from my server. Response Headers contains a valid Set-Cookie. Chrome Response/Cookies says that I have 1 cookie, ok. But... The cookie is not setting into DevTools/Application/Cookies /* My frontend on Vue I renamed 127.0.0.1 to www.example.com So running on www.example.com:80 or just www.example.com */ let response = await axios({ method: 'post', url: 'http://127.0.0.1:3000/api/login', // my Node server on 3000 port data: { email : login, password: password, }, }) /* My

How to fetch data in React/Redux from mongoose/mongodb using router to reflect changes in state of component?

孤人 提交于 2020-06-17 09:08:10
问题 Trying to render a component only the first time user logs into my MERN app to show a questionnaire, otherwise user is taken to the dashboard. I am able to manipulate redux state to show firstLogin as changing in my auth reducer by using an action that sets firstlogin to true (independent of the FirstLogin value changed in my database) after the user fills the questionnaire and even update the value of FirstLogin in the User's collection in my mongodb. I am sharing my authActions authReducer

Sorting CouchDB result by value

生来就可爱ヽ(ⅴ<●) 提交于 2020-06-17 06:44:31
问题 I'm brand new to CouchDB (and NoSQL in general), and am creating a simple Node.js + express + nano app to get a feel for it. It's a simple collection of books with two fields, 'title' and 'author'. Example document: { "_id": "1223e03eade70ae11c9a3a20790001a9", "_rev": "2-2e54b7aa874059a9180ac357c2c78e99", "title": "The Art of War", "author": "Sun Tzu" } Reduce function: function(doc) { if (doc.title && doc.author) { emit(doc.title, doc.author); } } Since CouchDB sorts by key and supports a

Multer - how to handle files using upload.fields() once files have been submitted

こ雲淡風輕ζ 提交于 2020-06-17 05:19:38
问题 I have been experimenting with Multer and was working on saving a movie document to MongoDB using Mongoose. After having the user submit an image in one input field and a video in a separate input field, I use multer's upload.fields() option to handle these files. I want posterImageName to save the filename for 'myImage' and trailerVideoName to save the filename for 'myVideo', so that I can display the image and video when fetched from my database. When I try to set these filenames in my

Multer - how to handle files using upload.fields() once files have been submitted

时光怂恿深爱的人放手 提交于 2020-06-17 05:19:00
问题 I have been experimenting with Multer and was working on saving a movie document to MongoDB using Mongoose. After having the user submit an image in one input field and a video in a separate input field, I use multer's upload.fields() option to handle these files. I want posterImageName to save the filename for 'myImage' and trailerVideoName to save the filename for 'myVideo', so that I can display the image and video when fetched from my database. When I try to set these filenames in my

Multer - how to handle files using upload.fields() once files have been submitted

浪尽此生 提交于 2020-06-17 05:17:23
问题 I have been experimenting with Multer and was working on saving a movie document to MongoDB using Mongoose. After having the user submit an image in one input field and a video in a separate input field, I use multer's upload.fields() option to handle these files. I want posterImageName to save the filename for 'myImage' and trailerVideoName to save the filename for 'myVideo', so that I can display the image and video when fetched from my database. When I try to set these filenames in my

Async/Await in Express Middleware

落花浮王杯 提交于 2020-06-17 01:52:33
问题 I'm having trouble understanding how to properly write middleware in Express that utilizes async/await, but doesn't leave a Promise floating in the ether after it's execution. I've read a ton of blogs and StackOverflow posts, and it seems like there is some consensus around using the following pattern in async/await middleware: const asyncHandler = fn => (req, res, next) => Promise .resolve(fn(req, res, next)) .catch(next) app.use(asyncHandler(async (req, res, next) => { req.user = await User