You are not logged in.
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
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
- 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
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
Thanks macfly, and ab.
Ab, why do you think i need a 3rd party app server for this?
Offline
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
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
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