#1 2019-05-31 10:43:53

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 55

i have an architecture question if i may ask (long post)

Hello Everyone,

I try to build a MVC application for my company and it's gonna be pretty big domain and i try to put stones in the right order. I am still a newbie imo with mormot/mvc etc. so don't get upset with me please smile

I am using MongoDB for our server.

I try to build a MVC application as a Default page for our customers and it will have lots of pages and services. Also need a api service running for other clients like most websites do. I am using MongoDB for database solution. Using mormot ORM with mongodb, which means ODM as it mention in documentation (i think). So i have some questions regarding mvc, and how to utilize URI's and etc. here we go.

- Is it possible to use multiple MVC applications with one RestServer+HttpServer? If so, how it will share session with each other? If user logged into Defaul app, he/she shouldn't need to relogin to another app.

- MVC actions work at server side make page to reload it's data, this is working great for most cases but i want to use ajax calls to reload only specific part of the page without reloading all page. I browse around this forum and AB said "you should use Interface Based functions for this" in some topic. I believe he is talking about an interface based api service which i should do any way. But, how should i use this api service from an MVC applicaton?

I have some ideas about this matter but they seemed off, not well coded.

First thought,  i could create a TSQLHttpClient to reach api service within MCV application for each session and and it's share it's sessionGUID within MVC applications session to use with URI's for ajax calls. I am not sure if it will work doh.

Second thought, using js library synopse-login to authenticate with Api server and use ajax calls. What i am struggling with is, how should i log user to my mvc app. I i use ajax call's to api, which will create a session and return id to me, then i should call mvc application to use this data to create it's own session. Is this right or there is some other way to achieve this?

- Can i use one HttpServer for both api and mvc and achive this:
            * 127.0.0.1/root/Default <- For MVC app
            * 127.0.0.1/api<- For api service

in case of "NO" i think i should use 2 servers with different roots and servicing from different ports but using the same Rest server. Is this the right way to go? Or i should give up using different roots because this is stupid to think to begin with.


I hope my questions are understandable, i am not a native english user, and hope to not bored you with simple questions.

Best regards

Last edited by koraycayiroglu (2019-05-31 10:50:23)

Offline

#2 2019-05-31 14:27:34

macfly
Member
From: Brasil
Registered: 2016-08-20
Posts: 374

Re: i have an architecture question if i may ask (long post)

- MVC actions work at server side make page to reload it's data, this is working great for most cases but i want to use ajax calls to reload only specific part of the page without reloading all page...

I think you can use a service, but also the mvc server itself. The difference is that instead of returning all the content of the page you will return only what you need to update on it.

- Can i use one HttpServer for both api and mvc and achive this:
            * 127.0.0.1/root/Default <- For MVC app
            * 127.0.0.1/api<- For api service

Yes, In fact you can include more services, such as:

* 127.0.0.1/root/Default <- For MVC app
* 127.0.0.1/api <- For api service interfaces-based
* 127.0.0.1/myservices <- For api service method-based
* 127.0.0.1/root/Users/... <- default ORM Publication of the service

Note: I suggest you disable this last option. To allow access only to services published via Interface or methods.
See: https://synopse.info/forum/viewtopic.php?id=4987

Last edited by macfly (2019-05-31 14:33:03)

Offline

#3 2019-06-01 12:48:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,686
Website

Re: i have an architecture question if i may ask (long post)

My first impression is that using a front-end like nginx would be solution for your multiple URIs.
It will also allow to have an unique point for supporting HTTPS, e.g. with https://letsencrypt.org/

Offline

#4 2019-06-01 17:30:06

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 55

Re: i have an architecture question if i may ask (long post)

Thanks macfly, and ab.

Ab, why do you think i need a 3rd party app server for this?

Offline

#5 2019-06-03 07:23:26

pvn0
Member
From: Slovenia
Registered: 2018-02-12
Posts: 211

Re: i have an architecture question if i may ask (long post)

It's general consensus to run any type of a server behind a reverse proxy such as nginx or apache, for flexibility and security reasons.

Offline

#6 2019-06-03 07:49:02

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,686
Website

Re: i have an architecture question if i may ask (long post)

In our proposal, nginx is not a 3rd party app server, it is just a load-balancing HTTPS server. It works on the HTTP (transmission) level, not at application (content) level.
There is no logic in here, just a way to publish a safe and scaling endpoint to the internet, from a unique HTTPS domain name.
The front-end, running as reverse proxy, could be local on the same server, or deployed in a single DMZ machine/VM (for enhanced security).

As pvn0 states, almost all serious professional solutions do as such (e.g. with nginx or haproxy).
Using a local nginx reverse proxy on the same computer than several local microservices instances, doing the URI distribution, is what we do in production on hundredths of servers - using FPC for Linux compilation.

Offline

#7 2019-06-10 09:01:20

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 55

Re: i have an architecture question if i may ask (long post)

I think i looked at to wrong nginx. I understand know. Sorry for late answer, last week was holiday in my country and i was on a vacation.

Thanks you all for your comments.

Offline

Board footer

Powered by FluxBB