Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base url for app #25

Open
techfort opened this issue Apr 13, 2015 · 2 comments
Open

base url for app #25

techfort opened this issue Apr 13, 2015 · 2 comments

Comments

@techfort
Copy link

Is it possible to set a base url (a bit like a java context) for the app? i tried the usual approaches, configuring the app with use(), making the main app a sub-app of a parent app, using express().Router, to no avail. If you have any suggestions or even better a ready-made approach, that would be great.
Basically I'd like to run the entire app at http://localhost:3333/foo

@baopham
Copy link

baopham commented Jul 11, 2015

Can you try: app.use('/foo', express.static('./src/client/'), app.use('/foo/*', express.static('./src/client/index.html')) and set the base URL in index.html: <base href="/foo/">

@BenihimeU
Copy link

Hi ,
I tried the above suggestion its not working for me. I made the changes in app.js
as follows,
app.js
app.use('/foo',express.static('./src/client/')); app.use('/foo/*', express.static('./src/client/index.html'));
in index..html
<base href="/foo/">

still not app not able to find resource files . Please help thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants