├── .gitignore ├── package.json ├── index.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.swo 2 | *.swp 3 | /node_modules 4 | /initrd 5 | npm-debug.log 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "start": "runtime start" 7 | }, 8 | "repository": { 9 | "type": "git", 10 | "url": "git@github.com:runtimejs/example-web-server.git" 11 | }, 12 | "license": "MIT", 13 | "dependencies": { 14 | "runtimejs": "*", 15 | "eshttp": "*" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const runtime = require('runtimejs'); 4 | const eshttp = require('eshttp'); 5 | const server = new eshttp.HttpServer(); 6 | const response = new eshttp.HttpResponse(200, { 'server': 'runtimejs' }, 'Hello World!'); 7 | 8 | server.onrequest = request => { 9 | request.respondWith(response); 10 | }; 11 | 12 | server.listen(9000); 13 | console.log('listening to port 9000'); 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ##[runtime.js](https://github.com/runtimejs/runtime) web server example application 2 | 3 | ### Install 4 | 5 | Clone this repository and install dependencies: 6 | 7 | ``` 8 | git clone https://github.com/runtimejs/example-web-server.git 9 | cd example-web-server 10 | npm install 11 | ``` 12 | 13 | Install the command line tool: 14 | 15 | ``` 16 | npm install runtime-cli -g 17 | ``` 18 | 19 | ### Run 20 | 21 | Make sure you have QEMU installed, then 22 | 23 | ``` 24 | npm start 25 | ``` 26 | 27 | *Note: runtime.js is work in progress* 28 | --------------------------------------------------------------------------------