Re: IBM i as a webserver with low cost tools
Marco Facchinetti <marco.facchinetti-kthxv0ud/[email protected]>
| Newsgroups | gmane.comp.systems.as400.web |
|---|---|
| Message-ID | <CAMsgu4q4ZrxfRc73Bz_DpKZviwmmYEzS9bMh41LakHP4eXtRWw@mail.gmail.com> |
"I suspect that IWS might be able to do almost the same thing, so it might not even be necessary, but I haven't had time to look." The marriage between RPG and IWS works very well. And IBM's support is (as always) great. HTH -- Marco Facchinetti Mr S.r.l. Tel. 035 962885 Cel. 393 9620498 Skype: facchinettimarco Il giorno gio 3 giu 2021 alle ore 13:33 Tim Fathers <[email protected]> ha scritto: > > The short(ish) answer is that it's built on Express, it basically just > extracts the HTTP headers, along with host name, method, cookies and a > bunch of other things and then passes them as a JSON object, together with > the request body, to a despatcher stored procedure. The despatcher > determines which application SP should process the request based on the > route and method (although any other criteria available could be used, such > as the "content-type" or "accepts" headers) and calls that. > > The despatcher and the processing SPs have four parameters: > in REQUEST - a JSON object with the header data mentioned above > in REQUEST_BODY - a JSON object with the request body (mine are always > JSON) > inout RESPONSE_DATA - a JSON object with the response data, similar to > the header data mentioned above > out RESPONSE - a CLOB/BLOB/JSON/XML etc. with the response body > > The SPs are able to inspect the REQUEST_DATA JSON parameter to find out > the path or query parameters or any of the other information relevant to > the call, populate the response body and fill in any relevant parts of the > response header information, such as status code, or content-type. > > Actually, while it's only about 80 lines of Typescript, there are another > couple of hundred lines of SQL in the dispatching and route resolution SQL > SPs, so a bit more than the few dozen lines I claimed! Also, the version I > currently use against a MariaDB database (hence the slightly different SQL > syntax above), I haven't ported it yet to the IBM i yet - but I don't see > any issue doing that, there's nothing database specific in the code. In > any case, I suspect that IWS might be able to do almost the same thing, so > it might not even be necessary, but I haven't had time to look. > > I'll stick the source on GitHub at some point, in case it's useful to > someone. > > Tim. > > > > ________________________________ > From: WEB400 <[email protected]> on behalf of Steve > Richter <[email protected]> > Sent: 02 June 2021 17:12 > To: Web Enabling the IBM i (AS/400 and iSeries) <[email protected] > > > Subject: Re: [WEB400] IBM i as a webserver with low cost tools > > > if you're on 7.2 or later, you can even build the JSON responses right > in the SQL and then you only need a > > very thin middleware layer (the one I currently use is just a few dozen > lines of Typescript). > > how does this work? > -- > This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing > list > To post a message email: [email protected] > To subscribe, unsubscribe, or change list options, > visit: https://lists.midrange.com/mailman/listinfo/web400 > or email: [email protected] > Before posting, please take a moment to review the archives > at https://archive.midrange.com/web400. > > -- > This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing > list > To post a message email: [email protected] > To subscribe, unsubscribe, or change list options, > visit: https://lists.midrange.com/mailman/listinfo/web400 > or email: [email protected] > Before posting, please take a moment to review the archives > at https://archive.midrange.com/web400. > > -- This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: [email protected] To subscribe, unsubscribe, or change list options, visit: https://lists.midrange.com/mailman/listinfo/web400 or email: [email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/web400.