How to deploy adonisjs to IIS Server

Is there a tutorial on how to deploy iis server in AdonisJS server? I already have a running express on my IIS setup and it works. However, I don’t know how to configure in adonis server.js. In order to run adonijs I have to call adonis serve which get me confusing since this is inside of IIS. How could I run it? Do I have to modified something on server.js? Please help thanks

1 Like

@rosnaib11 Can you share what exactly is not working?

You don’t need to call adonis serve everywhere. In production on Linux we end up doing something like pm2 server.js or node server.js.

You can get IIS to serve server.js and you should be good. Have you tried iisnode already?

Yes I have a working iisnode. It works on the example expressed. Still trying to figure out why all my routes are 404 not found. In the iisnode log I got

e[32minfoe[39m: serving app on\.\pipe\4942801d-f400-4b5f-b6fb-fdb52618ddfd


(node:5512) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

Not sure if that the cause.

and here is my web.config


      <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
        <rule name="bkbapi">
          <match url="/*" />
          <action type="Rewrite" url="server.js" />

    <iisnode nodeProcessCommandLine="node.exe --no-deprecation --no-warnings"/>

And when I access our routes its 404 /node/bkb_node_server/bkbapi, it should return my test route like what output in --dev

And I wish I could use pm2 but server is not have portforward, and I don’t have access to deal with it. So I have no choice at this moment.

Sorry - my knowledge of IIS is limited.

I would enable logging in AdonisJS and try to check whether it is server.js failure or IIS is unable to reach server.js due to error in rewriting rules or due to a external factors like a firewall.

@prashanth1k I think I found the answer, it works when I set the project outside the root directory. But my problem now is does adonisJS allowed to set baseURL similar to this issue that’s my only hope. I need to to have url like

when I set it to root<API>

It works. But I need to have a based url since the server targeted on it, I don’t have access to modify.

1 Like