Skip to content

splitscriptjs/https

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tiny package for sending and receiving https(s) requests

install size

downloads

docs

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)
}
v2.0.1 | docs

by ultraviolet

About

Send HTTPS/HTTP requests

Resources

License

Stars

Watchers

Forks

Packages

No packages published