This is a very simple HTTP server for Unix, using fork(). It's very easy to use
- include header
httpd.h - write your route method, handling requests.
- call
serve_forever("12913")to start serving on port 12913
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "path/filepath" | |
| ) | |
| func main() ([]string, error) { | |
| searchDir := "c:/path/to/dir" |
| public String multipartRequest(String urlTo, String post, String filepath, String filefield) throws ParseException, IOException { | |
| HttpURLConnection connection = null; | |
| DataOutputStream outputStream = null; | |
| InputStream inputStream = null; | |
| String twoHyphens = "--"; | |
| String boundary = "*****"+Long.toString(System.currentTimeMillis())+"*****"; | |
| String lineEnd = "\r\n"; | |
| String result = ""; |
| <app> | |
| <meta> | |
| <app:title>Title</app:title> | |
| <app:icon type="47px-47px">icon-47-47.png</app:icon> | |
| </meta> | |
| <page name="home"> | |
| <h1>Home</h1> | |
| <a href="page:example">Want another page?</a> | |
| </page> | |
| <page name="example"> |
| <?php include("latest-stable-handler.php"); launch_site(); ?> |
| <html> | |
| <head> | |
| <title>Pages</title> | |
| <script type="text/javascript"> | |
| WebFontConfig = { | |
| google: { families: [ 'Ubuntu:300:latin' ] } | |
| }; | |
| (function() { | |
| var wf = document.createElement('script'); | |
| wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + |
| <?php | |
| $render_template=true; | |
| if ($_SERVER["HTTP_X_PJAX"]) | |
| { | |
| $render_template=false; | |
| } | |
| ?> | |
| <?php | |
| if ($render_template) { |
| // | |
| // Created by John F. Mercer on Monday, December 5, 2011 | |
| // john.f.mercer@gmail.com | |
| // | |
| // tested on node 0.6.4 and express 2.5.1 | |
| // | |
| var express = require('express'), | |
| app = express.createServer(); | |
| app.use(express.logger()); |
| // module dependencies | |
| var http = require('http'), | |
| url = require('url'); | |
| /** | |
| * UrlReq - Wraps the http.request function making it nice for unit testing APIs. | |
| * | |
| * @param {string} reqUrl The required url in any form | |
| * @param {object} options An options object (this is optional) |