How does node.js handle authentication/user systems? - javascript

I come from Django's framework, and it has built in "user" system. It takes care of all the registrations, passwords, logins, etc.
Does Node.js have this?

You may want to browse through the packages on the node package manager (npm) registry for NodeJS extension modules that can be combined to enable you to authenticate users, talk to external user management systems, etc. For example, the node-http-digest extension for HTTP digest authentication.

I reviewed the documentation and found no user management system.
node.js is a JavaScript server where-as django is an MVC with built-in socket utilities.

Try to look at connect and express node.js modules. Namely express (which is built on top of connect) can be "compared" with Django's funcionality.

I know this is an old thread but wanted to share this link in hopes it can help others who come across this question.
Checkout Drywall; A website and users system for Node.js
http://jedireza.github.io/drywall/

Related

Accessing JSON through Javascript- Different options

Still a newbie. I am building a simple quiz app which I plan to take make public. The questions will be stored in a JSON. Trying to understand the right approach to build this:
The javascript file cannot read the local json file through fetch (URL scheme file not supported) or using jquery (I get CORS error)
I want to expose only part of the json file and different question will be shared everyday.
Do I need a nodejs server to address these requests? What is the right way to host this on a server? When I buy a domain, do I need to keep a server running there to service these requests?
Would appreciate a response on the approach.
Thanks,
There are different "Components" in building and deploying an application on the web.
To handle the User Interface (Website as we know it), we would require HTML/CSS/Js or a frmaework like React, Vue, Angular etc.
This frontend will be connected to a server (backend) that can be developed by using Nodejs(Express), Python(Flask), Java(Spring), Go etc...
Then there is a database, you can use SQL or noSQL databases. (As per your requirements, I would recommend using MongoDb Atlas, a hosted cloud database)
Initially, you are going to develop Front-end and backend seperately as deifferent projects. Then Integrate the APIs.
Now, you can either host these projects seperately, or together.
Now, for testing servers, you can use Heroku or Netlify, these services host your projects for free (upto a certain limit), once you are done with development and testing. You can pay these services or choose other services to host your project and do other stuff like a good domain-name, a SSL certificate etc.

Sails.JS or Loopback for Electron App

I am developing a image capture/storage software for school photographers that uses an angular front-end using electron to make it a native cross-platform desktop app. The app will need to have online and offline access. I will run a database on the client machine while offline and when online access is obtained it will sync to a cloud based database. In the future I want to be able to have the option for enterprise customers to run the application on premise and link to their own databases as well.
I was looking into using either Sails.js or Loopback to do this. Do you think one of the frameworks would be better for my particular use case? I would assume that both frameworks would be able to sync the offline data from multiple clients to the master cloud database using transactions easily? Any input you have would be appreciated! Thanks
(Also would react and redux be a better option for the font-end with electron opposed to using angular?)
Deciding which one suits you best is your call, but technically speaking Loopback can do what you need.
The offline/online sync is referred as isomorphic Loopback. Basically, you can run loopback client-side in offline mode, and when you get a connection it will sync with the remote server (that, ultimately, decides if the local data is accepted or not, depending on access control, validation, etc). There is an example repository. Be aware that this functionnality is still considered experimental.
Transactions are supported by some database connectors but not all of them. You can find the documentation here.

Create Node.js Website on remote server

I'm new to Node.js and I've been going through some tutorials. I've been able to make a simple web page in Node.js and run it as its own server from the command line on my desk top. However, I would like to create it to use it as a website that others can access, as well. Therefore I was wondering how can I host a web site built with Node.js on a remote server?
Option 1:
If you have public IP then you can host the website on your server
Option 2:
Find a service provider who can host your Node.js application. e.g heroku
I would recommend you check out Heroku. They offer a very simple hosting service at a variety of pricing tiers (including free) with a wide variety of add-ons. Deployment is as simple as pushing to a remote GitHub repository.

How to actually deploy a node.js (or django) project on a hosted web server?

I know this question may seem stupid but I've been googling and asking this question for a while since I decided to start learning node.js. Ok so I have a hosted web server over at X10Hosting (https://www.x10hosting.com/) and I'm wondering how I could host a simple node.js web app on it. Thanks, any help is GLADLY appreciated (an actual tutorial or documentation would be really help).
You can't deploy a NodeJS/Django in this type of server.
When you sign up for a free hosting plan in x10hosting, they give you a folder in their server.
When a request come for you, Apache/nginx (which their are webserver) will execute the corresponding PHP file in your folder and will give to the client the output.
NodeJS is a very different type of installation.
It have is own process which it will bind a port, handle and process the request, and give the client the output. So, you will need to install it on their server, but i don't think x10hosting will do that just for you. And Django work the same way.
Nodejitsu ( https://www.nodejitsu.com/pricing/ ), the "owner" of NodeJS can host your app for free if the application is open-source.
I hope this will help you ;)
x10hosting's free hosting service is a shared hosting service, that means that you're allowed a folder inside a system shared by many users. That system has PHP5 and MySQL (as I read in their website), but Django and Node.js are a very different software stack. See, software stacks like Django or Node must be installed by the system administrator in order to serve content like a website. The administrator provided PHP5 and MySQL, but no Node or Python support. With a VPS, or Virtual Private Server, you are your own sysadmin, and free to install and configure whatever you want in your system, but it's not the case for shared hosting.
The Django Project website has a list, with some shared hosting or private hosting providers that support Django and some of them are free. For NodeJS you should checkout the Node Wiki's hosting list.
If you want to deploy easily you can use Heroku, it's free if you use only one Dyno (You don't need more if you create a website with low traffic)
Heroku and the really good documentation (with article for django and nodejs) : Documentation

Node.js + Node-Webkit + Node-SerialPort Based Application - Is this Possible?

I am new to Node.js and before I go head first into taking on a new technology and migrating my c# based application, I wanted to make sure what I had in mind is possible with Node.js and if it is recommended.
So please let me know your opinion!
My application has the following requirements:-
TCP server (to receive packets from TCP clients such as smart phones, computers etc.)
Serial port access (To control a hardware device)
Web server facilities (to serve HTML5 pages or provide web services intefaces)
Simple native app like GUI for configuration.
All of this needs to be packaged nicely for end users to install simply.
Why I would want to do this you may ask?? The reason I am most interested in using Node.js is due to the cross platform nature, including the ability to install on cheap single board/embedded computers.
This is my thinking:-
Node.js - to provide the TCP server, serve HTML5 pages and provide web services interfaces.
Node-Webkit - to provide the simple native app like configuration interface. I also believe that it provides the ability to package my application for simple distribution, but I am not sure? (I could leave out Node-Webkit if there was another way to package my app for simple distribution. Although it is preferred as even having to find the IP Address of the computer so as to access a web browser interface would be tricky for some of my users.)
Node-SerialPort - to provide the ability to communicate with the hardware device. The instructions will come from 1 of three sources. 1) TCP connection 2) HTML5 Webpage Initiated 3) Web Services Initiated.
That's what most people use Node.js for
https://npmjs.org/search?q=serial+port
Again, that's what most people use Node.js for
Because of 1 and 3, the most obvious UI for node.js apps is the browser. Write a config page to control your app. Using node-webkit is overkill, just use whatever browser is already available. Node can run multiple listeners on multiple ports, serving the same app.
npm install is pretty simple.
Go learn how to write simple Node.js apps (with express for easy http servering, and jade or nunjucks for easy html templating) and then move up from there.
Point 5. I understand the fact of having an installer. I would suggest that the .msi or .exe will create a Windows Service for NodeJs. Then the node js server will launch at Windows startup and the end user will access the browser with
http://localhost:< a port number>/.
Packaging NodeJS : To package nodejs, you can copy the nodejs.exe from the installation directory of nodejs into the directory where you developp the node application. Then zip everything. You unzip it on another computer and it will execute.

Categories

Resources