Jump to content

Node.js Testing Web Server ✨


Emnawer

Recommended Posts

Just published a test web server, for testing Front-end web applications. The server will simplify your development process with a unified approach to unit testing. It will help consolidate your request and response tests into a single test file.
Download page: https://www.npmjs.com/package/serverette

Request Example:
<html><head><script>
fetch('', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ test: 'testing POST method' }) }) .catch(error => { console.error('POST Error:', error); });
</script></head>

Response Example:
callbacks.post = function(array,response){
// test your data here
test(array)
// Write response (also can redirect if you want) and close connection
response.writeHead(200, { 'Content-Type': 'text/html' })
response.end("POST data received for JEST testing!")
}

Console output:
Serverette port #: 8080
======================
GET: / MIME: text/html
POST: [ '{"test":"testing POST method"}' ]

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...