Cộng đồng các chuyên gia

Đặt câu hỏi và học hỏi từ các chuyên gia freelancer

6 Câu trả lời

Greg Bogdan
Greg Bogdan
answered 1 năm trước
Hãy thuê tôi

Hi moemoezz,

Well thats a good question. One of the most widely used frameworks is express.js, but it all depends on your API and if you want to build anything else, I mean besides API you want to add 1-2 pages.

Another option is restify.js, its an old player on the field and is very similar to express, except it does not have template support. If you only want REST API in your app, then restify should be a good selection

8 lượt thích
drudev
drudev
answered 7 tháng trước
Hãy thuê tôi

If you're new to Node or its web frameworks, I'd just stick to Express for now. It is by far the most popular framework and has tons of resources online. It may not specialize in REST webapps like some of the other frameworks, but it still does a great job.

To get started, all you really need is a few lines of code like this:

var express = require('express');
var app = express();

app.get('/hello', function(req, res) {
res.send({
message: 'world'
});
});

var server = app.listen(8080);

1 lượt thích
markasoftware
markasoftware
answered 6 tháng trước
Hãy thuê tôi

Everybody here seems to recommend Express, and it's definitely the most popular, but there definitely are alternatives worth taking a look at. Koa is another one, which is actually developed by Express developers. It is similar to Express in many ways, and uses the new "generators" feature in javascript to handle asynchronous code in a very interesting (and arguably better) way instead of just using callbacks. It also makes writing middleware easier because of the nature of generator functions. One more framework to use is Hapi, which has a much more verbose syntax than Express and usually results in longer code. This can be seen as a waste of time to write, but on the other hand it produces code that is arguably more readable than Express's.

0 lượt thích
Nayana Hettiarachchi
Nayana Hettiarachchi
answered 1 năm trước
Hãy thuê tôi

to find the best framework you have to try few of them and see what works best for you. the word "best" is personal. what works best for me may not work best for you. and "best" can have different meaning for different people.
for example i am happy with using just connect JS and keeping it light weight. Some prefer to bring a swagger based framework to provide a better UI for those who want to play with the API. Some can be hardcore and just build their rest stuff using just plain http. Hope this helps.

0 lượt thích
carlosgottberg
carlosgottberg
answered 1 năm trước
Hãy thuê tôi

I think ExpressJS is kind of a popular choice for it. That being said, there's probably no 'best framework'. All of them will have their share of advantages and disadvantages. You take what you feel comfortable with and be done with it.

It is generally a good sign if the framework follows common best practices and principles in software and that is easy to debug (if following best practices, this should not be a problem, should it ;) ).

@Techly: You might want to check Lumen (a micro-laravel) or Slim. Lately I've found myself spending a lot of time on PHP and... well, not my favorite language, you can be sure. The above paragraph applies to this as well.

0 lượt thích