Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

How do i create a DOM element without reloading the page (using js, node, and express)?

Hi. I have 2 questions; 1 : How do i create a DOM element without reloading the page? I am working on a big project with a few friends, a designer and one who makes HTML and CSS. I do the front-end JS, and back-end node. I need to create elements in the page without reloading, because it will have to reload A LOT of times, and i've seen how annoying that can be.

2: How do i completely hide my source code? (I have googled it and it said two things: 1: Remove the ".map" files. I dont have any .map files, or 2: Encrypt your code, but it said that if people try, they can decrypt it.) I want it 100% guaranteed that nobody can see my source code, because i have my own custom encryption system on a js file, and when i import it in a client side js file, it shows everything on the clients browser.

If 2 is impossible, how can I make a get request to a route via fetch() on client-side to encrypt the data i send it, and then send it back encrypted? The problem is that i want it to be secured, so nobody else can send a request to it.

I apologize if this is too much, but i have a limited time to finish this project.

Thank you, Glaukio

1 Answer

Anything client side is completely visible, if it has to be private, it needs to be serverside.

And anyone can make a request, you just need to make sure your server rejects any unauthorized requests.

You may want to follow a few more courses before attempting this project.