2.0.1 • Published 2 years ago

@splitscript.js/https v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

npm.io

install size

downloads

About

This package is part of SplitScript.js, the everything framework

It's a tiny package for sending http(s) requests

Install

$ npm i @splitscript.js/https

Listen for requests

Start the server

import https from '@splitscript.js/https'
https.start({ port: 3000 })

Handle requests

Create a file in functions/http/get

import { Events } from '@splitscript.js/https'
export default async function ({ req, res }: Events.Get) {
	res.write('<html><body><h1>hello world</h1></body></html>')
	res.end()
}

Parse body

Bodys get parsed automatically

import { Events } from '@splitscript.js/https'
export default async function ({ req, res, bodyParsed }: Events.Post}) {
    res.end(JSON.stringify(bodyParsed))
}

Raw body

To get the raw body

import { Events } from '@splitscript.js/https'
export default async function ({ req, res, body }: Events.Post}) {
    res.end(body)
}

by ultraviolet

1.0.5

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago