Node.js, Express and Mongoose : automatic CRUD API [closed] - javascript

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Coming from python world, we heavily used tastypie or Django-Rest-framework to create Rest API.
Reading through Convincing the boss from Felix Geisendörfer, i noted the following statement:
Building light-weight REST / JSON api's is something where node.js really shines. Its non-blocking I/O model combined with JavaScript make it a great choice for wrapping other data sources such as databases or web services and exposing them via a JSON interface.
When I try to learn Node.js and find the best way to implement a REST API using existing and reliable modules (like tastypie for Django); I just can't find a node.js module which handle those actions (GET,PUT,POST,DELETE,PATCH) based on a model automaticaly.
You will find a lot of tutorials saying how to implement a basic rest api, but I didn't find module ready to be use in a large production app. (i found Restify , mers ...)
What do you guys are using? Existing modules or you prefer developing your own controllers to handle those tasks and creating your own routes manually?

Check a list of Node.js frameworks, here for example. A lot of them provide REST out of the box.
Take a look at Sails.js, for example. With this one you can create a model and get a REST API within seconds.
As for the production-ready thing, it somewhat depends indeed on your own criteria and the requirements you are imposing.

Related

How do I create an API and add data via a CSV file? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm trying to build an API for a react project and I'm unsure of how to build an API.
I have a CSV file with all the data.
I've used api-platform via PHP but every time I try to input the CSV into the tables in Sequel Pro it crashes.
I'm now thinking of using node.js.
Very confused as to which technology to use and the best approach to my problem.
Looked at many articles and tutorials that have helped build a basic RESTful API however none of them address how to add a CSV file into the tables or database.
My personal recommendation when building an RESTful API in Node.js is to use express.js. Easy to get started with and has many plugins.
Other possible frameworks that I can think of right now:
hapi.js
koa.js
For reading and writing CSV-files, take a look at this article
I think python can handle CSV files better. You can create API using Django.

Web applications with javascript [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Now I program all my web apps with Flask or Django. (blogs, social networks...). I need templates, db access, controllers, routing...
Now I want to do same web applications, but with javascript.
People tell me : You need NodeJs for server-side, Angular for the front, and for example firebase or mongodb. Or also you can use Express JS.
But can I just use Angular JS and Firebase for start a big web app ? Need I Node if Angular can Access/Update/Delete in my db ?
Angular is a client-side framework, so you'll have to at least have some web server to serve your static files. Other than that, if you're using Firebase, you wouldn't technically need any server-side code to handle your logic - but naturally, that depends strongly on what data your application deals with.
If what Firebase provides, doesn't cut it for your cases though, you will need a server-side, and pretty much any web application framework would do. Node.js (using Express), PHP, ASP.NET, whatever your heart desires.
And yes, Angular works perfectly well for creating big complex web applications.

JavaScript WebApi references: where to store them? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Im new to javascript and want to start writing code as clean(correct) as possible. I use C# WebApi as backend and simple pure HTML + JavaScript project for frontend.
Up until now I stored configuration for my frontend in javascript files like this:
var serviceUri = 'http://localhost:666/api/service';
And just use them somewhere.
In real applications this should be outside any javascript files, at least in my opinion. Similar to how I do it with .NET stand-alone applications or WCF services. How I should store this kind of configuration for frontend application? What is best practises?
You do not need to specify the server location of the web api in javascript. If you just use var serviceUri = '/api/service'; it will take the current server location of your page.
And if you are using static files the problem that you have to change the service location both in the js and the web api will remain and cannot be get rid of without you implementing your own compile tools (which will be a pain in the ass to find the correct routing and so on).
In the enterprise solutions I've worked on we just deal with it. You could create a js file to have all the api endpoints in one place but this could easly get ugly when there are to many.

Build a Task Management App using Javascript [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am looking to build a Order Management and Task Management App for my company. I am a beginner in Programming and know only Javascript (Can manage with HTML and CSS ) . This app would also require to connect with a database. Is it possible to build it only using Javascript (without the use of any other languages like PHP etc) and is it advisable. Is there any other more feasible solution.
If Javascript will suffice, a few more queries in the same line
What database would be the best to use ?
Would using Angular JS help ?
How do I search and use if theres a similar project in Github that runs only on Javascript ?
suggest you read more about the MEAN stack, it's a very popular stack that let you build the whole stack (DB, Server side logic, Client Side logic) with Javascript alone.
in short:
MongoDB, a NoSQL database
Express.js, a web application framework that runs on Node.js
Angular.js, a JavaScript MVC framework that runs in browser JavaScript engines
Node.js, an execution environment for event-driven server-side and networking applications
using the angular JS is optional in my opinion, it is required if you want to make it to feel as single page app.
try this on github, an example for MEAN stack.
You have to Choose
Nodejs Server (Javascript)
AngularJS Client (Javascript )
Mysql Backend
They are More Flexible with friendly Solutions
You could build and host your app on something like https://firebase.google.com/ - build the entire thing in eg polymer and let google host it, that way you'd be building the thing entirely in JS, no other language required

Promising alternatives for javascript framework? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Popular JavaScript frameworks/libraries like jQuery, MooTools, Prototype, and YUI (to name a few of the most popular JavaScript frameworks out there) definitely have a solid foothold in the JavaScript framework arena.
But for the more adventurous developers looking for new or alternative frameworks/libraries, there are options like:
SproutCore
Spry
JavaScriptMVC
qooxdoo
midori
Archetype JavaScript Framework
June Framework
UIZE
SimpleJS
Fleegix.js
Each one has its own merits. But which is preferable for what over which?
I think server-side javascript has an exciting future.
Things like node.js and jaxer might pave the way for an environment that makes a compelling argument for writing an application strictly in javascript. There's a lack of frameworks right now, and a lack of general javascript libraries (for things other than traversing the DOM ;) but that might change.
I can't tell you how many times I've wished I didn't have to port over various bits of model code to javascript, or resorted to RPC style requests just so I don't repeat myself. I can port the drawUserVcard() function to javascript (say, from Python) so that I can generate a vcard dynamically on the frontend from json data, but then I have consistency issues because my ported code needs to track the original Python generated result.
Aside from server-side "don't trust the client" operations, a lot of processing can be offloaded to the user. Why print HTML in Python/PHP/Ruby? Actually, none of those languages have an API as nice as jQuery for HTML manipulation. Why query a database in Python just so you can generate some json that you pass off to your client scripts? Why not just read json data directly (CouchDB) from the database and let the client hydrate it.
There's so much room for improvement here.

Categories