node.js

Hapi showing undefined variable inside handler

浪尽此生 提交于 2021-02-11 10:50:03
问题 I'm using Hapi.js for a project and a config variable that I'm passing to my handler is coming up as undefined when I call my route. What am I doing wrong? server.js var Hapi = require('hapi'); var server = new Hapi.Server('0.0.0.0', 8080); // passing this all the way to the handler var config = {'number': 1}; var routes = require('./routes')(config); server.route(routes); server.start(); routes.js var Home = require('../controllers/home'); module.exports = function(config) { var home = new

Hapi showing undefined variable inside handler

淺唱寂寞╮ 提交于 2021-02-11 10:48:18
问题 I'm using Hapi.js for a project and a config variable that I'm passing to my handler is coming up as undefined when I call my route. What am I doing wrong? server.js var Hapi = require('hapi'); var server = new Hapi.Server('0.0.0.0', 8080); // passing this all the way to the handler var config = {'number': 1}; var routes = require('./routes')(config); server.route(routes); server.start(); routes.js var Home = require('../controllers/home'); module.exports = function(config) { var home = new

Hapi showing undefined variable inside handler

ε祈祈猫儿з 提交于 2021-02-11 10:46:31
问题 I'm using Hapi.js for a project and a config variable that I'm passing to my handler is coming up as undefined when I call my route. What am I doing wrong? server.js var Hapi = require('hapi'); var server = new Hapi.Server('0.0.0.0', 8080); // passing this all the way to the handler var config = {'number': 1}; var routes = require('./routes')(config); server.route(routes); server.start(); routes.js var Home = require('../controllers/home'); module.exports = function(config) { var home = new

Node JS Nodemailer POST internal server error 500

浪尽此生 提交于 2021-02-11 10:37:05
问题 Hi all I am trying to send email from my website with nodemailer and express routing after press send button i have info /contactForm 500 internal server error any idea how to solve it. //app.js // CONFIG const express = require('express'); const app = express(); const exphbs = require('express-handlebars'); const compression = require('compression'); const config = require('./src/server/config/config'); const http = require('http'); const path = require('path'); const cookieParser = require(

Creating a dataservice to communicate between c# api and frontend (angular)

我只是一个虾纸丫 提交于 2021-02-11 09:02:03
问题 I need some help with this. I'm supposed to create a plugin for a webpage in angular that communicates with an API written in C# which is already in a .dll. What is the best approach to this? I already created a data.service.ts with the following code to get data from the api: import { Injectable, ValueProvider } from '@angular/core'; @Injectable({ providedIn: 'root' }) export class DataService { edge : any = require('edge'); constructor() { } getData(type: String, method: String) { var data

Using node.js to decrypt data encrypted using c#

孤者浪人 提交于 2021-02-11 08:56:10
问题 I'm facing a issue now which need you guys help. I use c# to do some encryption. Then need to use node.js to decry-pt it. But I just found that I can't do it correctly base on my c# encryption algorithm. If you guys have any solution, please help me. Here is my c# encryption code: public static string Encrypt(string text, String password, string salt, string hashAlgorithm, int passwordIterations, string initialVector, int keySize) { if (string.IsNullOrEmpty(text)) return ""; var

Using node.js to decrypt data encrypted using c#

眉间皱痕 提交于 2021-02-11 08:55:10
问题 I'm facing a issue now which need you guys help. I use c# to do some encryption. Then need to use node.js to decry-pt it. But I just found that I can't do it correctly base on my c# encryption algorithm. If you guys have any solution, please help me. Here is my c# encryption code: public static string Encrypt(string text, String password, string salt, string hashAlgorithm, int passwordIterations, string initialVector, int keySize) { if (string.IsNullOrEmpty(text)) return ""; var

npm start error but node index.js works

北战南征 提交于 2021-02-11 08:32:30
问题 I started learning nodejs and followed this tutorial to create a simple web app. https://blog.risingstack.com/node-hero-tutorial-getting-started-with-node-js/ According to the tutorial I can run the web app using either 'npm start' or node index.js' . When I use node install.js it works and give the result. But when I use npm start this error occurs. npm ERR! Linux 4.4.0-38-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! file

node/express - missing ) after argument list [closed]

我们两清 提交于 2021-02-11 08:17:07
问题 Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Improve this question new to node... const express = require('express'); const bodyParser= require('body-parser'); const MongoClient = require('mongodb').MongoClient; const app = express(); app.use(bodyParser.urlencoded({extended: true})); app.set('view engine', 'ejs'); module

Can't run npm install

一笑奈何 提交于 2021-02-11 08:05:00
问题 In here it says to run npm install , but I get this error when I run sudo npm install . sudo npm install npm WARN enoent ENOENT: no such file or directory, open '/var/www/html/mg/package.json' npm WARN mg No description npm WARN mg No repository field. npm WARN mg No README data npm WARN mg No license field. without sudo: npm install npm WARN enoent ENOENT: no such file or directory, open '/var/www/html/mg/package.json' npm WARN mg No description npm WARN mg No repository field. npm WARN mg