Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80551 views
1
import url from 'url';
2
3
let baseUrl;
4
5
if (typeof window === 'undefined') {
6
const port = process.env.PORT || 3000;
7
baseUrl = `http://localhost:${port}`;
8
} else {
9
baseUrl = '/';
10
}
11
12
export function siteUrl(to) {
13
if (typeof to === 'undefined') return baseUrl;
14
15
return url.resolve(baseUrl, to);
16
}
17
18