Thursday 1 June 2017

nodeJS couldn't load angular

i have a problem about nodeJS and i am trying to learn nodeJS and pretty much beginner.

here is the location of the folders :
- application
-- controllers
--- mainController.js
-- lib
--- js
---- angular.min.js
-- views
--- index.html
- routes
- server.js

so i have this server.js and it's running :

var express = require('express'),
app = express(),
port = process.env.PORT || 3000;
var routes = require('./routes/routes');

app.use(express.static(__dirname + '/application')); //static path
routes(app);

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

app.listen(port);
console.log('server started on: ' + port);

but angularJS is not loaded in index.html :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Testing Web</title>

    <!-- LOAD JS -->
    <script src="../lib/js/angular.min.js"></script>
    <script src="../controllers/mainController.js"></script>

</head>

<body>

</body>

</html>

anyone has solution for this?



via rinaldy31

No comments:

Post a Comment