Serving SPA on S3 - Question

#1

Hello all,

I’ve never served a static site via S3 and I’m unsure how I would accomplish this with Adonis. I built an SPA using Webix and now I’m trying to figure out how to bypass Adonis views, as I just want to serve a traditional index.html file.

I’m sure this isn’t necessary in production, but I’d like to see how to get it working locally first.

Can anyone give me any tips/direction?

Thanks

0 Likes

#2

Hey @twigs67! :wave:

Instead of having Adonis serving the entry point of your SPA I’d recommend to simply run two servers locally. One that serves your SPA and the other one would be your Adonis API.

2 Likes

#3

This is the same setup I have for my application on AWS, usually I would have two servers, one serving my API and the other serving my web pages.

1 Like

#4

So I’m kind of confused how this would work. You serve the app/pages on one server that has the DNS setup at app.example.com and then how would you setup the API server? Do you have it share the same DNS or I guess that the API server DNS is arbitrary.

0 Likes

#5

let’s you have an instance with the public IP 137.0.43.92 you could have both API and the frontend pages set up on this IP.

the pages can have the DNS example.com and the API can have this example.com/api

0 Likes

#6

Sorry for the late reply.

I generally use the primary domain for my front office (example.com) and use a sub-domain for the api (api.example.com).

In my case, I serve my SPA with Netlify (free tier). That means example.com point to my Netlify instance (CDN) and api.example.com points to my server where my Adonis application reside.

0 Likes