从url中删除名称文件html

时间:2017-05-03 22:08:24

标签: javascript html angularjs

我使用Angular JS作为前端,使用Express Server作后端。

我正在尝试从我的网址中删除init.html。

我已阅读其他帖子,但我无法解决此问题。

现在:http://localhost:3000/init.html#!/export

我想看起来像:http://localhost:3000/#!/export

我试过:$ locationProvider.hashPrefix()和

locationProvider.html5Mode(true)但它无效。

管理器-app.js

SELECT eventId,
       ConcertName,
       Concert_Date
FROM   (
  SELECT e.event_id EventID,
         c.concert_name ConcertName,
         c.concert_date,
         e.attendance,
         AVG(e.attendance) OVER () AS avg_Attendance
  FROM   event e
         INNER JOIN concert c
         ON c.concert_id = e.concert_id
)
WHERE  attendance < avg_attendance;

index.html是一个静态HTML

init.html

angular.module("ManagerApp", ["angularUtils.directives.dirPagination", "ngRoute"]).config(function($routeProvider, $locationProvider) {

$routeProvider
    .when("/", {
        templateUrl: "/index.html"

    })
    .when("/export", {
        templateUrl: "export/listExport.html",
        controller: "ListCtrlExport"
    });

index.js

     <html ng-app="ManagerApp">
<head>
    <title>
        ManagerApp
    </title>
    <link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap-theme.min.css" type="text/css" />
    <script type="text/javascript" src="/bower_components/jquery/dist/jquery.min.js"></script>
    <script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/bower_components/angular/angular.min.js"></script>
    <script type="text/javascript" src="/bower_components/angular-route/angular-route.min.js"></script>

    <script type="text/javascript" src="/bower_components/angularUtils-pagination/dirPagination.js"></script>
    <script type="text/javascript" src="/bower_components/bootbox.js/bootbox.js"></script>

    <script type="text/javascript" src="/manager-app.js"></script>
    <script type="text/javascript" src="/export/list-ctrl.js"></script>
    <script type="text/javascript" src="/export/edit-ctrl.js"></script>


</head>

<body>
    <ng-view></ng-view>


    </header>

</body>

</html>

exportModule

var express = require("express");
var bodyParser = require("body-parser");;
var helmet = require("helmet");
var path = require('path');


var app = express();
var folder = path.join(__dirname, '/public');


var MongoClient = require('mongodb').MongoClient;
var mURL = "mongodb://XXXXXXXXXXXXXXXXXxXXXXXXXX";


var port = (process.env.PORT || 10000);
var BASE_API_PATH = "/api/v2";

var moduleExport = require("./api/v2/exportModule.js");

var dbAlberto;
var dbUser;

app.use("/", express.static(path.join(__dirname, "public")));
app.use(bodyParser.json()); //use default json enconding/decoding
app.use(helmet()); //improve security

app.use("/",express.static(path.join(__dirname, 'public')));


app.use("/api/v2/tests", express.static(path.join(__dirname , "public/test.html")));

MongoClient.connect(mURL, {
    native_parser: true
}, function(err, database) {
    if (err) {
        console.log("CANNOT connect to database" + err);
        process.exit(1);
    }

    dbAlberto = database.collection("exports");

    dbUser = database.collection("user");

    moduleExport.register(app, dbAlberto, dbUser, BASE_API_PATH);

    app.listen(port, () => {
        console.log("Magic is happening on port " + port);
    });
});

提前致谢!

0 个答案:

没有答案