Configure Node.js Application in cPanel

Asked

Viewed 134 times

-1

The first time I created this, I had no problem, I did an update on my server.js recently (which is the line app.use("/api", orcamento)) and went to update her...

By clicking on Executar a instalação do NPM makes the installation of the items of the package.json (had a new item too that was the nodemailer)

By clicking on Run JS Script a message says it ran without errors, but when opening the application URL, the image appears.

inserir a descrição da imagem aqui

Man server.js

var express = require("express");
var bodyParser = require("body-parser")
var compression = require('compression');
var helmet = require('helmet');

var post = require("./routes/post.js")
var usuario = require("./routes/usuario.js")
var categoria = require("./routes/categoria.js")
var orcamento = require("./routes/orcamento.js")
var cors = require("cors")

var port = 3000

var app = express();

app.use(cors())

app.use(bodyParser.json({limit: '50mb'}))
app.use(bodyParser.urlencoded({limit: '50mb',extended: false}))
app.use(compression());
app.use(helmet());

app.use("/api", post)
app.use("/api", usuario)
app.use("/api", categoria)
app.use("/api", orcamento)

app.listen(port, function () {
  console.log("Server started on port: " + port);
})

EDIT

I tried to go putting line by line in my server.js and running the script la in cPanel, the problem is when you put the lines

var post = require("./routes/post.js")
var usuario = require("./routes/usuario.js")
var categoria = require("./routes/categoria.js")
var orcamento = require("./routes/orcamento.js")

Someone knows how to help me?

1 answer

0

for my case, the problem was on this line

var usuario = require("./routes/usuario.js")

opening my usuario.js, I did the same process of removing the require that I had and the item was the bcrypt, I looked on the net and I saw that I had a more updated one that was the bcryptjs...

I made the changes and it worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.