keithwhor / nodal

API Services Made Easy With Node.js

Home Page:http://www.nodaljs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I render my html page

vipinpal opened this issue · comments

commented

It is a question rather than a issue.
Anybody know how to render a HTML PAGE in NODAL ?

Short Answer is: don't.

Longer Answer is: Controller expose a .render() method that can accept any string.

Even Longer Answer is: Please don't do this. Use a separate server for rendering HTML content, static assets, templates. If you need to populate pages with data from your Nodal database, send an HTTP request to your Nodal API server for the information. Either from the client (XHR) or from your static asset server (node's http module). I have a library for doing this easily from Node (https://github.com/keithwhor/api-res).

I have a solution in the works for creating static websites, but it won't be ready for a few weeks at the earliest.

commented

I meant is there any method or lib to expose an API in NODAL, like a strong loop remote method

User.remoteMethod(
        'getUsers',{
            http:{ path: '/v1/users' , verb:'get' },
            accepts:[],
            returns:[
                {arg : 'results', type: 'array'}
            ]
        }
    );