Accounts in serverside JavaScript (node.js) - javascript

I'm making an online game and I was wondering - how can users create accounts? Do I need a database, and if yes, which one? Also how do I get information from the users? I believe by using html tag, but how exactly? I'm not using PHP for the serverside, but node.js.

There are so many answers to this question it's tough to begin at one place.
I'll just suggest some technologies because that seems to be what you're looking for. Ultimately I recommend you research this area and make up your own mind on what you'd like to use.
You can use a database to store the user information. NoSQL is popular nowadays so I'll go for a MongoDB solution http://www.mongodb.org/
You don't exactly need to use HTML tags as there are template solutions written for node.js. I recommend jade https://github.com/visionmedia/jade
There are frameworks and middleware created to make all of this easier. Check it out here https://github.com/joyent/node/wiki/modules

Related

NodeJS: Data persistence layer

We are building the messaging application in javascript using nodejs. As part of durability of the overall solution, we need to store text messages and media content outside ejabberd. To keep the text messages we used DynamoDB, DB as Service. But when we port-in the solution with different customers, customers are asking for different DBs for which they have licenses, like mysql, postgres, sql server, oracle, DB2, mongoDB etc...
Now my question is,
Does ORM/ODM is a good fit here for a loosely coupled persistency layer? If so, javascript supports ORM/ODM based solution
If ORM/ODM is not good fit, what are the alternatives
Just a thought, I looked at TypeORM, it does provide loosely coupled persistency layer to port-in with different back-end systems..., is this a feasible framework to take it forward.
Happy to hear experts inputs.
Regards
Venkata Madhu
TypeORM is a good candidate since it supports almost all the databases you mentioned (except DB2), I've worked with it and it's one of the best if you also want good typescript support.

How can I add a JSON object created with angularjs to an array on my server

I'm mainly a front-end devloper, so the basic server-side aspect of the project I'm working on is escaping me.
My main webpage has a list of products pulled from a JSON array with angularjs' ng-repeat, but I'd like to add an administrative page in which authenticated users could push a JSON object to the array. How can I do this with no experience in any server-side scripting languages?
I hate to be the bringer of bad news, but when dealing with user permissions, you need to be using some kind of back-end technology.
Theoretically, you could store authentication information in the JSON that denoted whether or not a user is an admin, and display the content/assign permissions accordingly. The problem with this technique is that, since the code is on the client side, hacking the admin page would be as easy as altering the JavaScript. This method would provide literally no security whatsoever.
If this is okay with you, then go ahead. But I would strongly advise learning some kind of server-side technology.
Given that you're a font-end developer, I'm assuming you already know JavaScript, so maybe doing this in Node would be a good option. Node does have a learning curve in and of itself, but knowing JavaScript will help significantly. You'll also need some kind of basic database to store the login information. Some kind of noSQL dialect such as MongoDB would probably work well here.
For doing advanced permissions, you'd want to use something like LDAP or Active Directory, but for what you're describing this would probably be overkill.
Remember, learning new things is fun! Good luck!

How do I connect a sql server to my Javascript game?

I'm working on a project and I just need a holistic overview on how to go about it.
I'm going to use HTML/CSS canvas to make the game.
However, the game involves visualization of large amounts of data that is best served in a database. What I do not know how to do is:
Link my HTML/CSS game to a SQL database
Parse a text file to populate the database.
I don't have specific issues I just don't even know where to start? Some people have said AJAX? Others have said parse.com?
You have two options:
write a server-side application to serve data from a DB
use client-side HTML5 storage (such as local storage, WebSQL, IndexedDB, etc)
If you use the server implementation you will need AJAX to communicate with the server.
To do this you will have toove beyond JavaScript and learn server side programming. The good news is there are tons of awesome server side languages that make building websites easy.
If you come from a javascript background, ruby would probably be an easy transition. I'd suggest Sinatra.
If you are using SQL server, c# and asp.net are great choices that are very well designed, thou c# is very different from JavaScript as a language.
Like python? Web2py and Django are good.
Then there is PHP and java...
You would probably write an API in one of these server side languages, access it using Ajax to retrieve Jason and process it.
And don't bother with parse.com. write your own parser in the language of your choice. Its usually really easy, and instructive.
I think you already know a language you can use. How about javascript? Of course a real serverside language like Java or PHP would be better - maybe as already told: ruby but why not try it with node.js:
Node.js could be the first thing you may look at. (http://nodejs.org/)
It's really nice & well documented - there is also a big question about node.js with mysql: MySQL with Node.js which also works fine.

Is Node.js suitable for my project given how I'm using it?

I'm about to start writing an application and I want to include newer technologies to improve my knowledge and gain a skill set.
I'm using mysql to store user data (no choice), Angular.js to display/template content on the dom, and I wanted to use node.js to return results from the database in json format to be used by Angular.js.
My assumption was I could use node.js (along with the node-mysql module and maybe express)to accomplish my database queries that feed into my Angular.js templates.
Additionally, the application will live on a different server than the database itself and may reside in a mobile framework.
Am I way off base when it come to how to use node.js? Am I just using the wrong tool? Am I on the right track?
Any help, explanation, and points in the right direction would be great. Most of the info I've seen are copy/paste from the node.js site/wiki and don't really answer my question.
This is largely an opinion-based question and likely to be closed, but you're not way off base. What you want to do is absolutely (and commonly) done using Node.js.
As a complete aside, you might like to check out Platform-as-a-Service providers such as Heroku.com and Nodejitsu.com; both offer great and easy Node.js hosting and addons (such as NoSQL and RDBMS data stores) which have free tiers.
For that matter, MongoLab and MongoHQ both offer free tiers independent of Heroku, which you could use from your MySQL-only hosting provider if you like.

Is it possible to retrieve data from parse.com using objective-c and show it in website?

I have an iOS app in which I use parse.com as backend service. Now, I hired someone to do a website interface using HTML and CSS. I want to share the same data between iOS app and website, I know parse.com offers me a few ways to do this, including creating a javaScriptapplication. The problem is, my programmer doesn't have any experience in JavaScript, nor do I.
My question is: Is it possible to use what I have (objective-c, xcode) as far as retrieving data from parse.com and showing on website? Even if I need to code something new, is it possible to use objective-c together with HTML and CSS?
Thanks.
Parse has several APIs, one of which is REST. Your web developer should use the REST API to get data from Parse
https://www.parse.com/docs/rest
If there is will there is way, but you'll be making something really specific to your use and will be non standard and will be immediately hard to maintain, I recommend that you hire another developer and do things properly using the technologies given to you by parse !. if the cost will be high now I can promise you it'll be much higher if you went the path you're going to now.
So my answer is:
Yes, everything is possible and no, don't do it ! :)
Edit: Added an example to a possible way to do it to actually answer OP's question.
Example case:
1-Create a simple Mac Application in Xcode that fetches data exactly like you do it on iOS, and store the needed data into a database of your choice on your server
2-You now have access to the data you needed from parse, but on a local mirror. you will need some tool to fetch that data though, I recommend a simple PHP script.
Note that this will require an OSX server to always be running to fetch that data, you'll also need of find a way to fetch data on demand when a user needs it Vs. polling at specified intervals, this will hardly scale and will be costly as I said.

Categories

Resources