2.0.18 • Published 7 years ago

iced-http v2.0.18

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

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
2.0.18

7 years ago

2.0.17

7 years ago

2.0.16

7 years ago

2.0.15

7 years ago

2.0.14

7 years ago

2.0.13

7 years ago

2.0.12

7 years ago

2.0.11

7 years ago

2.0.10

7 years ago

2.0.9

7 years ago

2.0.8

7 years ago

2.0.7

7 years ago

2.0.6

7 years ago

2.0.5

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago