How to use Ionic Framework for Web App Development?

后端 未结 6 1582
暖寄归人
暖寄归人 2020-12-22 18:46

Is it possible to use ionic frameowork for regular Web Applications rather than wrapping it in Cordova?

6条回答
  •  借酒劲吻你
    2020-12-22 19:28

    Orane is right.

    When You "node app.js" your app runs a server. We need to provide this server with all files we want. With Ionic Application it's basically www folder. In following example i put all contents of www folder to my public folder.

    My root folder has app.js file and public folder. That's how app.js looks like:

    var express = require('express');
    var app = express();
    var server = require('http').createServer(app);
    
    app.get('/', function (request, response) {
        response.sendFile(__dirname + "/public/index.html");
    });
    app.use(express.static(__dirname, 'public'));
    

    In public folder i have all frontend css and js. We included the whole folder public in code above. Now in index.html of public You should include files with public/, like this:

    
    

    All the best, anybody, feel free to ask anything about Node.js+Ionic Framework

提交回复
热议问题