Yode-server
Setup
First, install MongoDB and Memcached and run both
Yode-server also requires node.js version 0.10 and above
Also we need Imagemagick for operations above images
mkdir yode
cd yode
npm install yode-server
npm start yode-server
Usage
The installer creates www
directory. Or you can choose another name during installation.
This is where your projects to be placed. In www/localhost
you’ll find a sample project.
All backend files are located in www/localhost/modules
,
all static files (css, images, browser-js) are in www/localhost/static
,
html-templates are in www/localhost/view
Each new project requires separate directory inside www
. The name of project directory must be same as host name. For example: if your project hostname is www.example.com
the path should be www/www.example.com
Command
npm start yode-server
or
node server
starts all virtual hosts located in project directory. If you need to start only one of them, specify it:
node server -p www.example.com
run yode-server as daemon:
node daemon
Admin interface
Admin panel default access (don't forget to add the port number in case it's not 80):
http://localhost/admin/
login: yeti
pass: 111111
Hello world (easy)
// file: www/localhost/modules/hello.js // the pattern of a yode-module// object "server" contents connections to mongodb, memcached and has more useful properties exports { thisserver = server;} exportsPluginprototype { }
in the browser http://localhost/hello:helloWorld/
Hello world (MVC)
Model code
// file: www/localhost/modules/models/hello.js exports { thisserver = server;} // as in the previous example but an object has passed to the callback.exportsPluginprototype { }
View, template code
<!-- file: www/localhost/view/hello.tpl uses jqtpl engine -->${text}
Controller code
// file: www/localhost/modules/hellomvc.js exports { thisserver = server;} exportsPluginprototype { var me = this meserver}
See the result: http://localhost/hellomvc:helloWorld/
You can also use the model as REST-service in external apps: http://localhost/models.hello:getHello/
"Hello World" on CMS virtual pages
- Log into admin interface:
http://localhost/admin/
(yeti:111111) - Go to Start -> Site tools -> Pages
- Click (+) icon
- Enter page name
- Select template
- Click [Add] - button (in right-bottom panel
Page blocks
) - Enter
hellomvc:helloWorld
to fieldContent type
- Save
Now you can see your "Hello World" on the new page (the path is in the second column of pages tree in admin-panel)