Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gulp.task("server", ['build'], function () {
- $.util.log($.util.colors.green("Server started at http://localhost:" + 4000));
- server.listen(PORT);
- open("http://localhost:" + PORT);
- });
- server.get("*", function(req, res){
- var base = __dirname + "/dist";
- var path = base + decodeURIComponent(req.path);
- console.log(path);
- try{
- var stat = fs.lstatSync(path);
- }
- catch(e){
- res.sendFile('index.html', { root: base });
- return;
- }
- if(stat.isFile())
- res.sendFile(path);
- else{
- res.sendFile('index.html', { root: base });
- }
- });
Add Comment
Please, Sign In to add comment