Skip to content

High level http client and server tools for rapid prototyping and deployment

Notifications You must be signed in to change notification settings

dan-velez/iced-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Http client and server tools built atop of Express.js Includes file uploading and body parsing.

Usage

	IcedHttpServer = (require 'iced-http').IcedHttpServer
	path = require 'path'

	class ImageServer extends IcedHttpServer

		install: =>
			@db = new mongodb 'mongodb://url'
			@app.get '/', @index
			@app.get '/img/photo.png', @getPhoto
			@app.post '/upload-image', @uploadImage

		index: (req, resp)=>
			resp.sendFile path.resolve './img/photo.png'

		uploadImage: (req, resp)=>
			files = req.files
			username = req.body.username
			for filename,file of files
				await @db.uploadFile "Files::#{username}", file, defer err, resp
				throw err if err
			resp.json 'files recieved'

	# Quickly deploy a server with file uploading and a body parser
	imageServer = new ImageServer port:80

About

High level http client and server tools for rapid prototyping and deployment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published