Heroku Node server: Possible to just serve plain HTML pages? - html

I was wondering if I could just upload a bunch of HTML (or any) files and have them reachable by URL, without specifying the routes, the static files, etc. The app is NodeJS/ExpressJS app, but I would like to serve some files and folders from that app like regular HTML pages.

Sure, just configure your directory as an Heroku PHP application by doing:
$ touch composer.json
and pushing that to your application. Heroku will now see your app as a PHP app and serve it directly, even though you only have static files.

Related

Hidding Servers Filesystem in Gatsby / ReactJS?

I am about to learn ReactJS.
I want to hide the filesystem structure of my server and only show the project root.
If i go to inspect tools in google-chrome i can see where my project is located on my C: Drive.
Wasnt able to find something about it and Ive got no Idea.
Hopefully, someone can help me.
This is because you are using your computer as a server to serve your site so the inspect tools are able to recognize the origin of the code, assets, and images.
Locally, even using gatsby develop or gatsby build (and gatsby serve) you will always be able to see the root of your project, it happens with all web development files, not only in Gatsby.
In a real scenario, where it's a server (with a domain attached, not your PC) that serves the files you will never see the origin because your site will be placed in the /public or /www of your server. To prepare your project to be deployed, you should run gatsby build command, which will create a /public folder in the root of your project with your code compiled, that folder is the one that needs to be deployed.
This is normal in development environment, for deploy your project try one of these approach in root of you project:
npm build
or
yarn build
This command build an optimized version of your project in build folder, after you can upload content of this folder to your www/plulic folder of your server,

Gulp download remote JSON files during build

I have a static site reliant on a remote JSON file which is under my control and doesn't change much.
I'm using gulp to build the static site and would like to add a gulp task to automatically get the remote JSON during the build, so I can include it as a local file.
I've not come across a plug-in to do this. Can anybody suggest one?
Found it! https://www.npmjs.com/package/gulp-download-files will allow you to download files locally.

Permanently redirect Jekyll pages to external site without markdown?

Using Jekyll/Github pages. As part of a content overhaul, we've moved a lot of pages to an external site. We'd like to clean up our Github pages repository and remove all purged files while providing a 301 redirect to the new domain where they now live.
The problem is that - according to my understanding of the docs - you must have a markdown file present with a redirect_to field. This defeats the purpose of purging the files in our repo. Is there a way to configure redirects from the _config.yml file or a plugin that allows me to do this from a single file?
I cannot see how this can be possible on the GitHub platform. As you mentioned, you can use the jekyll-redirect-from plugin but you cannot automate it through config or other data files because Jekyll sites are static and thus, the server will only look for the directory and an index file within it for each URL.
The only way you can achieve this without keeping the file structure is to move the site to a server where you configure URL rewrites within the web server such as Nginx or Apache.

Index.html/index.php not found in Google CodeLabs app shell

I was interested on on Google's web app-Shell. I've downloaded it GitHub. But I found that there is no index.html/index.php file in the whole code. All I mainly found, is the licence file, app.yaml file and app.js file. Link to that page, is here.
I heard,that I can install the project in my web hosting site, by using terminal. But terminal is not an option for my situation. I've stopped using Firebase, because I must have terminal for it. So, is there any other idea to install the project in my website?
Can I have a flat file, so that I could simply past the html,css, JavaScript and other media files into my server?
Unfortunately the Google web app-Shell isn't designed to have an index.html file. There is a views folder that has what you're looking for https://github.com/GoogleChromeLabs/application-shell/tree/master/server/views.
As we can see they're using handlebars for as a templating system. For example, if we look at https://github.com/GoogleChromeLabs/application-shell/blob/master/server/views/layouts/default.handlebars we can see that they have {{> open-page}} and {{{body}}}. If we look at handlebars documentation these partials are rendered into other views.
Essentially, there isn't a single index.html we can point to, but we can reconstruct the app by exploring their views.

Subdirectories in openshift project cannot be found

I built a site using a php openshift project and accessing the root directory via http works fine. However, all the root directories give me a 404 not found, like this one: http://test.toppagedesign.com/sites/
I checked with ssh, and /app-root/repo/sites and app-deployments/current/repo/sites/ both exist.
EDIT
Added a directory called php and now I have 503 errors for everything...
EDIT 2
I deleted the php directory, now the 503 errors are gone. However, I do still get 404 errors for the subdirectory.
Here is my directory tree: http://pastebin.com/hzPCsCua
And I do use git to deploy my project.
php is one of the alternate document roots that you can use, please see the March Release blog post here about this (https://www.openshift.com/blogs/openshift-online-march-2014-release-blog)
As for the sub-directories not working, can you ssh into your server and use the "tree" command to post the directory/file structure of your project? Also are you using Git to deploy your project or editing files directly on the server?
You need to have an index.php or index.html file in any directory that you want to work like app-domain.rhcloud.com/sites , if you just have sub-directories, how would it know what to show? Also, indexing (showing a folders contents) is not enabled for security reasons, and I believe there is no way to enable it.
This sounds like it could be a problem with how you are serving your static content.
I recently created a new sample app for OpenShift that includes:
a basic static folder
an .htaccess file (for serving assets in production)
support for using php's local server to handle the static content (in your dev environments)
Composer and Silex - a great starting point for most new PHP apps
You can serve the project locally if you have PHP-5.4 (or better), available in your dev environment:
php -S localhost:8080 -t static app.php
For a more advanced project that is built on the same foundation, take a look at this PHP+MongoDB mapping example. I wrote up a blog post with some notes on my process for composing that app as well.
Hope these examples help!