Make it embeddable as standalone
This commit is contained in:
parent
4ccdc569d8
commit
bfad8bf232
3 changed files with 132 additions and 0 deletions
16
examples/HelloLoopery.js
Normal file
16
examples/HelloLoopery.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* This is a script not for Node.js but runs completely stand-alone using loopery */
|
||||
print('Welcome to loopery!');
|
||||
|
||||
const port = 3000;
|
||||
|
||||
App().get('/hello', (res, req) => {
|
||||
res.end('world!');
|
||||
}).get('/*', (res, req) => {
|
||||
res.writeHeader('content-type', 'text/html; charset= utf-8').end(req.getHeader('user-agent') + ' är din user agent, biatch!');
|
||||
}).listen(port, (token) => {
|
||||
if (token) {
|
||||
print('Listening to port ' + port);
|
||||
} else {
|
||||
print('Failed to listen to port ' + port);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue