Comments (8)
The idea behind serveOrigin
is that it is used for dev mode and overrides serveFolder
. Carlo should not be used without serveFolder
, because it defeats Carlo's purpose. You can run express and point your browser to the port if all you want is serve.
from carlo.
Did you update carlo
to the last master state?
from carlo.
Yes, it's the latest.
from carlo.
H'm. I have a different issue:
'use strict';
const carlo = require('carlo');
(async function main() {
try {
const app = await carlo.launch();
app.on('exit', () => process.exit());
app.serveOrigin('https://example.org');
console.log(app.serveOrigin);
await app.load('index.html');
console.log(await app.evaluate(() => location.href));
} catch (err) {
console.error(err);
}
})();
[Function: serveOrigin]
Error: Please call app.serveFolder(__dirname) or point to other folder(s) with your web files
at App.load (carlo\lib\carlo.js:122:13)
at main (test.js:14:15)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
from carlo.
My bad,
UnhandledPromiseRejectionWarning
with npm 0.9.11
master
results are same as yours
from carlo.
I got it to launch by adding app.serveFolder('@')
'use strict';
const carlo = require('carlo');
(async function main() {
try {
const app = await carlo.launch();
app.on('exit', () => process.exit());
app.serveOrigin('https://example.org');
app.serveFolder('@')
console.log(app.serveOrigin);
await app.load('index.html');
console.log(await app.evaluate(() => location.href));
} catch (err) {
console.error(err);
}
})();
from carlo.
I can also manage with this:
'use strict';
const carlo = require('carlo');
(async function main() {
try {
const app = await carlo.launch();
app.on('exit', () => process.exit());
app.serveOrigin('https://example.org');
app.serveFolder('/');
await app.load('index.html');
console.log(await app.evaluate(() => location.href));
} catch (err) {
console.error(err);
}
})();
(The location is a bit confusing though: https://domain/index.html
)
Maybe doc example needs to be updated with app.serveFolder()
added?
from carlo.
Perhaps it could be changed in load()
?
load(uri = '') {
if (!this.www_.size) {
if (this.wwwOrigin_) {
this.www_.set('/');
} else {
this.page_.close();
throw new Error('Please call app.serveFolder(__dirname) or point to ' +
'other folder(s) with your web files');
}
}
return this.page_.goto(`https://domain/${uri}`, {timeout: 0});
}
And it'd be implicitly set, saving from confusion as mentioned above
app.serveOrigin('https://example.org');
// app.serveFolder('/');
await app.load(); // no URI passed
from carlo.
Related Issues (20)
- Using Chrome executable from puppeteer HOT 6
- hot reload? HOT 3
- carlo will not launch on win10 HOT 2
- Steps towards implementing require() in Carlo HOT 12
- Notification.onclick() doesn't seem to work HOT 2
- can i use carlo as puppeteer ? is there any example?
- Keyboard's shortcuts are always mapped in QWERTY
- Problem loading next.js statically exported site
- carlo Remote devices, the inspect button is disabled
- How to make localhost node-GraphQL request from index.html?
- Use Carlos as a communication channel b/w Chrome and Electron
- createWindow fails silently when invalid args are provided
- `serveFolder` doesn't work with spaces in file names
- File picker with input tag crashes application
- Is this unmaintained ? HOT 7
- Exit the process directly when failed to found `chrome`?
- Chrome takes 6s to load when not specifying executable path
- The packed executable file cannot work
- Why the bundle package size is so large? HOT 1
- Dead?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carlo.