gbowne1 / RadioLogger

A Radio Logging application build with NodeJS and ExpressJS
GNU General Public License v3.0
6 stars 6 forks source link

Duplicate name file #37

Closed jzunigarce closed 1 year ago

jzunigarce commented 1 year ago

The client/public/js folder have two file with same name signUp.js and signup.js. We should homologate in a single file

image
gbowne1 commented 1 year ago

I agree. @jzunigarce These were both remnants of previous attempts at this project, so, I dont know which file actually works or if we need a new file.

AlexVCS commented 1 year ago

Hi there, I'd like to work on this issue. Can you assign it to me please?

gbowne1 commented 1 year ago

Ok, @AlexVCS.

AlexVCS commented 1 year ago

So I should just put the contents of the two files into one file? Is signUp.js the preferred name if so?

gbowne1 commented 1 year ago

That is the way it is named in the login.html file. It won't work if you just copy the contents of the other file into one of them. You'll have to test to see if signUp actually works when the app is running.

jzunigarce commented 1 year ago

I am currently working on the login functionalities in the backend

gbowne1 commented 1 year ago

I tried with testuser@example.com (as example.com could be wired in till we get full backend up incl. database) and generated password. No go, no matter what I tried. It should even give you some visual indicators of success or failure to the user as an alert, toast, popper, etc. all of which Bootstrap has built in now. (Popperjs is deprecated now.)

AlexVCS commented 1 year ago

I cloned the project and installed the dependencies in the client server directories(npm i). Are there test credentials for me to put into my .env?

gbowne1 commented 1 year ago

@AlexVCS you can put any boolean value into SESSION_SECRET= in the .env

You will also need:

MONGODB_URI=mongodb://username:password@host:port/database
PORT=3000
jzunigarce commented 1 year ago

The values of .env are: image You can add whatever value you want for the port, host and secret

AlexVCS commented 1 year ago

Thanks. I tried adding what you both mention but keep getting errors when trying to run the app.

This is what the file looks like after your recommendations:

MONGODB_URI=mongodb://username:password@host:port/database
PORT=4000
HOST=2000
SESSION_SECRET=true

I can run the client or the server but not both at the same time. It says secret option required for sessions. Do I need a mongo username and pw?

gbowne1 commented 1 year ago

You have to start mongod and the cd to src/server and start the server. Client and server I have on the same port. It works fine. I have not needed to run the client. Then go to your browser and go to localhost:3000. That is the native port and is set elsewhere in the code.

Make sure that its MONGO_PORT and MONGO_HOST not just port and host.

Set up mongodb with db named radiologger and whatever username and password you like.

AlexVCS commented 1 year ago

Ok when you say set up mongodb what do you mean? Create a cluster?

gbowne1 commented 1 year ago

No. Just install Mongodb and create a user, password and create a db called radiologger.

Start mongod which is its server with the command mongod and then cd to src/server and then npm start. Then go to your browser and go to localhost:3000

gbowne1 commented 1 year ago

Still not able to login, or redirect to dashboard aftee successful register or login. Although, it gives an array in console.

Theres no login database.

jzunigarce commented 1 year ago

Have you already registered user account? you can use postman for call the endpoint register. Can you share the error that the console shows you?

gbowne1 commented 1 year ago

yes I registered testuser, password testpass, email testuser@example.com

I like using example.com which can legally be hard wired as it is an official testing TLD (top level domain) and it may return a result.

I did not get any error.

I haven't used postman yet.

jzunigarce commented 1 year ago

So your problem is the login, you can't redirect to the dashboard?

gbowne1 commented 1 year ago

yes. There is also no thing to show the user login success or even an error. They would have to look at the console. I look at it from a users perspective.

There should be some form of toast, popper, alert, snackbar.. something to show the user that it either passed or failed.

jzunigarce commented 1 year ago

We can use https://sweetalert2.github.io/ or alert of bootstrap

gbowne1 commented 1 year ago

yes I would prefer Alert from native bootstrap, and Alert is good anyhow.

gbowne1 commented 1 year ago

Will work on the original issue ASAP but there is a duplicate so closing this one.