Is client-side routing recommended along with server-side routing, provided angular -universal

I am just starting with Angular Universal and completely new to 'isomorphic' javascript.

I am a little confused about how to have a logical routing system, do you want to create a universal Angular as a typical node rest api? Or is it literally just designed to instantly serve client code and receive data from an external api source / rest?

As for the Angular universal starter kit, for example, it starts with these routes;

app.get('/', ngApp);
app.get('/about', ngApp);
app.get('/about/*', ngApp);
app.get('/home', ngApp);
app.get('/home/*', ngApp);

is it logical to include node / express / mongo api in it to receive / send data? i.e

const bearRoutes = require('./routes/bear')
app.use('/', bearRoutes)

If so, could you use a hash strategy to distinguish URLS?

angular2, api, , ?

!

+4
1

, , angular node rest api?

. angular-universal . , .

node/express/mongo api / ?

. Hello World github API app.use, node REST.

, , URLS?

, - # URL- . , , , URL- URL-, angular / HTML-, /API.

: . . ,

app.get('/', ngApp);
app.get('/about', ngApp);
app.get('/about/*', ngApp);
app.get('/home', ngApp);
app.get('/home/*', ngApp);

app.get('/api/profile', serverAPIAppOrprofileJSON); 

angular2, api, , , ?

, - , . , , . .

+6

Source: https://habr.com/ru/post/1658957/


All Articles