Closed MB-ITC closed 4 years ago
Hi @MB-ITC each endpoint is served by this application, for example: https://github.com/Incognito/one-time-secret/blob/master/src/WebControllers/AuthorController.ts#L12
You are able to introduce a new controller that is able to serve js/css/img files stored on the host. You would also of course need to bind the controller to the route (done here: https://github.com/Incognito/one-time-secret/blob/bceb21b37defa43c61824a6ebb426015397e3f8a/src/WebControllers/router.ts#L8)
If at all possible, I'd advise hosting assets on nginx or some static content host instead however. That would be better for security (no code to maintain, not ability to accidentally serve the wrong files due to a programming error). It would also provide a better experience because servers like nginx would be better for serving multiple assets at the same time, and it already has the logic for how to add HTTP headers to images/js/css.
Documentation added. https://github.com/Incognito/one-time-secret/wiki/Serving-Assets
The deployment of the app was relatively simple, but I am struggeling to find any kind of "public" folder since I am not familiar with Typescript and default node. As far as I can tell there are templates in the src folder with inline css, but i want to add logos, custom css and some javascript. I have tried to add the folders "img,js,css" to "src/templates", but during the build process they aren't added to "dist".