mardi 24 avril 2018

vue.js variables is not Working With Node.js :

i am trying to run vue.js code inside my node.js app , but when i run my code using node index.js in terminal i got in browser instead of

HTML:

<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="/style.css">

<title>Document</title>
</head>


<body>

<div id="app">
    <h1>
        
    </h1>

</div>

</body>
</html>

JavaScript:

var Vue = require('vue');
var express = require('express');
var app = express();
var http = require('http');
var server = http.Server(app);


server.listen(3000,function () {
    console.log('starting the server');
});

app.use(express.static(__dirname));

app.get('/',function (req,res) {
    res.sendFile(__dirname +  +'/index.html');
})


new Vue({
    el:'#app',
    data:{
        name:'john'
    },

})

Any Help :)

Note: i am using vue module installed from npm




Aucun commentaire:

Enregistrer un commentaire