updated index.js

master
parent 1d9aca0118
commit 973cdde5b2

@ -6,12 +6,6 @@ const {verify, verifyAdmin} = auth;
const multer = require('multer');
let filename = __filename;
let dirname = __dirname;
console.log(filename)
console.log(dirname)
const storage = multer.diskStorage({
destination: (req, file, cb) => {
cb(null, 'public/images/');

@ -45,12 +45,6 @@ module.exports.registerUser = (request, response) => {
module.exports.loginUser = (request, response) => {
const reqBody = request.body;
let filename = __filename;
let dirname = __dirname;
console.log(filename)
console.log(dirname)
User.findOne({email : reqBody.email}).then(result => {
if(result === null) {
return response.send(false);
@ -62,7 +56,7 @@ module.exports.loginUser = (request, response) => {
const token = auth.createAccessToken(result);
return response.send({accessToken: token, filename: filename, dirname: dirname});
return response.send({accessToken: token});
}else{
return response.send(false);

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

@ -8,6 +8,7 @@ const cors = require("cors");
const port = 4002;
const app = express();
const path = require('path')
mongoose.connect('mongodb+srv://admin:admin@b330juan.sxv2kqg.mongodb.net/Capstone-2?retryWrites=true&w=majority');
@ -24,7 +25,7 @@ connect.once("open", () => {
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({extended : true}));
app.use(express.static('public'));
app.use('/images', express.static(path.join(__dirname, 'images')));
app.use("/b2/users", userRoutes);
app.use("/b2/products", productRoutes);

Loading…
Cancel
Save