The Progressive Server-side JavaScript Framework
You know HTML & CSS?
But not JavaScript?
Quickly create multilingual websites effortlessly with simple routes, views or variations.
JavaScript client-side Expert?
Ready to embrace Node.js?
Gradually improve your base as you need by using controllers, models or modules.
Already your Front-end habits?
You use Data Binding?
From Vanilla to jQuery and going through Vue, Angular or React: use your favorite tools!
An NodeAtlas instance is configuration-driven with webconfig.json
. All NodeAtlas website has it, that turn the engine from « Simple Web Server » to « NodeAtlas Web Server ».
NodeAtlas isn't a standard MVC hierarchy. One of is particularity is the capability of the controller to render the view without any development from you.
We will start with a how-to set minimal files to perform a "Hello World!".
After installing NodeAtlas, you can create a set of files representing a site in the folder of your choice. In the example below, we will use hello-world
directory:
hello-world/
├─ views/
│ └─ index.htm
└─ webconfig.json
We will display to the HTTP address the content of the views/index.htm
file:
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8" />
<title>Hello world</title>
</head>
<body>
<div>This is a Hello World!</div>
</body>
</html>
See just below following, the content of webconfig.json
file.
You can turn a simple page with minimal configuration webconfig.json
below :
webconfig.json
{
"routes": {
"/": {
"view": "index.htm"
}
}
}
equivalent to
webconfig.json
{ "routes": { "/": "index.htm" } }
node-atlas
command lineIf you have installed NodeAtlas with npm install -g node-atlas
you can use the node-atlas
command. node-atlas
is a alias for the command node </path/to/globals/>node_modules/node-atlas/
.
Note: you can also use the
atlas
command which is an alias ofnode-atlas
for writing it more simply.
Position yourself with the prompt console in the folder hello-world/
and run the following command.
$ node-atlas
Note: if your port 80 is in use or if you don't have the privilege to access it, you can use the
--httpPort
options.
$ node-atlas --httpPort 8080
or use the webconfig option
httpPort
{ "httpPort": 8080, "routes": { "/": "index.htm" } }
You will have access to your "Hello World" to the page: http://localhost/
in a browser (or http://localhost:8080/
).
You can also use NodeAtlas as an npm module.
So, create a server.js
file into the same folder of webconfig.json
.
server.js
require("node-atlas")().start();
Then run the file with Node.js.
$ node server.js
It's also possible to get an app already create with some features already implemented. We study them later but for now just use --create
command to test that and copy a skeleton app:
$ node-atlas --create hello-world
and Start!
$ node-atlas --browse