This topic contains 4 replies, has 3 voices, and was last updated by Sean 1 year, 1 month ago.
Angular Theme with Express.js + Node.js doesn't work
You must be logged in to reply to this topic.
This topic contains 4 replies, has 3 voices, and was last updated by Sean 1 year, 1 month ago.
Hi,
I try to use te theme and as standalone works fine, but when I try to use ir with a Express/node server Angular doesent load correctly 🙁 The errors that i receive is
Uncaught SyntaxError: Unexpected token <
I attach a couple of screenshoots.
¿Can you help me please?
I solve it! =D
I need to specify the folder with my js files for Express can serve static files:
app.use(express.static(__dirname + ‘/public’));
app.use(express.static(__dirname + ‘/public/app’));
I found that info on http://expressjs.com/en/starter/static-files.html
Great! Well done. Thanks for sharing this solution. Good luck with your project 🙂
Hi. I could not get it.
I’m trying to set a MEAN app, but when I try to set the express on main.js (on js folder) it doen’t work.
like that:
/***
// Metronic AngularJS App Main Script
***/
var express = request(‘express’);
var app = express();
app.use(‘/’, express.static(‘deepfreeze/views’));
/* Metronic App */
var DeepFreezeApp = angular.module(“DeepFreezeApp”, [
“ui.router”,
“ui.bootstrap”,
“oc.lazyLoad”,
“ngSanitize”
]);
I’m also trying to serve the app on port 3000, instead of 8080.
But when I set an app.js file calling it, all the js and css files could not be found. I receive a console log as 404 status.
How can I serve the Angular version with Express????? Please, anyone can help me?????
Thanks!!!
Hi,
First you should check the issue outside the theme and make sure the port you are accessing is working.
Metronic including gulp task to launch a localhost using https://www.npmjs.com/package/gulp-connect.
You can check(if haven’t yet) the documentation “_documentation/index.html” and try to launch the gulp localhost server.
If you need any further help please let us know.
Thanks.
You must be logged in to reply to this topic.