Is atom-live-server a good web server solution plugin for web-game coding?

James Hancock
James Hancock used Ask the Experts™
on
Hi,
I found an "atom-live-server" Atom plug-in to allow for simple set-up of a live server with the project's files instantly accessible from a browser / runtime
It was recommended by a Javascript web-game coding page.
Does the plugin look suspicious/ not as good as apache? It means I can easily do local / LAN testing.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
AlexA lack of information provides a lack of a decent solution.

Commented:
It's looks ok, there are no major warning signs that it's dodgy, essentially it's down to what you want.

Regards
Alex
Dr. KlahnPrincipal Software Engineer

Commented:
Have a look at the web server usage statistics at this page:

https://w3techs.com/technologies/overview/web_server

Atom doesn't even show up on the list of "servers with less than 0.1% use."  It's hard to recommend something that thinly used, if only on the basis of "who will help me when I have problems?"
AlexA lack of information provides a lack of a decent solution.

Commented:
The above is for public web servers, not ones internally for testing which is what ATOM is used for. Atom is a development server, not something to publish with.

Regards
Alex
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Fractional CTO
Distinguished Expert 2018
Commented:
Tip: Many people do random local testing, then when they attempt to deploy to some type of public server, many problems arise.

Better to either deploy on a public server, which will eventually become the production server (how I develop projects).

Or run a local dev environment which exactly matches your production server (difficult to get a direct match).

It's highly unlikely you'll run Atom as your live server. Better to start with your real server.

Suggestion: Setup your server to run HTTP2 + HTTPS (HSTS + OSCP Stapling) + Brotli. You'll be surprised how fast this type of setup runs.
James HancockSelf Employed

Author

Commented:
Thanks,

That’s what I assumed would be the answer. The plugin is appealing because I don’t know what my final setup will be, if it will happen, even, and am learning
James HancockSelf Employed

Author

Commented:
Interesting.

I installed it, and instead of interpreting the javascript into a page, the browser just prints the code at that URL.
I have the same address as the IDE states the server is serving from..and in my browser URL bar.
127.0.0.1:3000/js/index.js

js/index.js  is my own folders in the IDE/ project folder.
The files can be loaded, but they aren't rendered, just text-dumped

Make any sense?

Thanks
David FavorFractional CTO
Distinguished Expert 2018

Commented:
This likely means an incorrect MIME type is being returned for .js files, which is common for dev type servers.

Again... for best development, use a straight up Apache server running on a public IP, which will eventually become your actual public server.
James HancockSelf Employed

Author

Commented:
Thanks a lot

Anything else I should be aware of this early, with an Atom JS project using Apache?

Should be plain sailing?
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Yep. Should be smooth sailing.

Tip: Just be sure you have your MIME expires headers for JS + CSS + HTML all set to the past, in other words no caching of any of these MIME types.

The primary problem most people run into testing code is making changes + never seeing the changes, due to expires headers triggering browser caching.
James HancockSelf Employed

Author

Commented:
Thanks,

I've never heard of this need before. How is MIME relevant? How do I check it out on a Mac?

Will my players need to worry?
David FavorFractional CTO
Distinguished Expert 2018

Commented:
1) How is MIME relevant?

See below.

2) How do I check it out on a Mac?

See below. You'll use curl for this.

3) Will my players need to worry?

Yes. This is highly relevant. In your case likely what you'll do is version all your Javascript files... maybe something like...

lxd: net16-david-favor # tstamp
20191219-112532

# Then version your .js file
game-system-20191219-112532.js

# Then set your HTML components to expire in the far past, see below
#  which will force any change to the game-system-*.js file name to be
# pushed to browsers for every change.

Open in new window


Examples...

You'll use curl to fetch some asset, checking headers... as in...

For example...

imac> curl -I -L https://davidfavor.com/jquery-3.4.1.min.js
HTTP/1.1 200 OK
Date: Thu, 19 Dec 2019 17:18:56 GMT
Server: Apache/2.4.41 (Ubuntu)
Strict-Transport-Security: max-age=63072000; preload
Upgrade: h2,h2c
Connection: Upgrade
Last-Modified: Wed, 01 May 2019 21:14:27 GMT
Accept-Ranges: bytes
Content-Length: 88145
Cache-Control: max-age=2592000
Expires: Sat, 18 Jan 2020 17:18:56 GMT
Vary: Accept-Encoding
X-Edge-Location: YUL
Content-Type: application/javascript

Open in new window


This shows jquery is cached until Date: Thu, 19 Dec 2019 17:18:56 GMT contrasted with...

imac> curl -I -L https://davidfavor.com/
HTTP/1.1 200 OK
Date: Thu, 19 Dec 2019 17:20:02 GMT
Server: Apache/2.4.41 (Ubuntu)
Strict-Transport-Security: max-age=63072000; preload
Upgrade: h2,h2c
Connection: Upgrade
Last-Modified: Thu, 01 Aug 2019 11:31:47 GMT
Accept-Ranges: bytes
Content-Length: 11685
Vary: Accept-Encoding
Cache-Control: max-age=0, public, no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-Edge-Location: YUL
Content-Type: text/html; charset=UTF-8


Which shows the HTML component for this site expires on Expires: Thu, 01 Jan 1970 00:00:00 GMT which is in the far past.

This is called Cache Busting which ensures MIME types (in this case text/html) is never cached.

When running dev/staging/test servers, best practice is to set expires headers to far past for JS + CSS + HTML + XML... or whatever other MIME types are involved in testing.

This keeps testing very simple.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Note: This question is starting to skew into many long term server runtime configuration considerations.

Best close out this question, then open other questions about how best to configure servers to push file changes to players as soon as any change occurs.

For example...

If a game is being played + changes must be made, doing this via an actual Javascript file change will fail in many ways.

What you'll do instead is have a single Javascript file, which never changes, ever, implementing fast AJAX round trips to the server to actually load your game code changes + share map changes between players, if this will be a multiplayer game.

You may even find using Websockets will be required, depending on game state changes, specific payload size + frequency data changes.

All this items are better dealt with before a single line of code is ever written, as retrofitting all this... will be... near impossible...

Note: Taking this approach also means your game code is far better obfuscated + protected against theft... rather than placing your entire game engine into a Javascript file.

Suggestion: Close out this question + open another question describing your exact game system, asking for design suggestions.
James HancockSelf Employed

Author

Commented:
Thanks
David FavorFractional CTO
Distinguished Expert 2018

Commented:
You're welcome!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial