Skip to content

A responder function you can pass into a http.createServer to work with your frameworkless Node.js HTTP app. Supports serving static files and routes!

Notifications You must be signed in to change notification settings

frameworkless-js/responder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@frameworkless/responder

A responder function you can pass into a http.createServer to work with your frameworkless Node.js HTTP app. Supports serving static files and routes!

This module comes from the output of the Frameworkless.js online course.

Installing

Not ready yet! But will be...

npm i --save @frameworkless/responder

Quick Start

Here's the quick, simple usage with the Node's built in HTTP server:

const { createServer } = require('http')
const { responder } = require('@frameworkless/bodyparser')

const responderOptions = {

  // If you want static files
  static: {
    directory: 'public'
  },

  // If you want dynamic routes
  routes: {
    directory: 'routes',

    // And if you want templated routes
    templates: {
      directory: 'templates'
    }
  }
}

const server = createServer(responder(responderOptions))

server.listen(1234)

Form data

Your routes need form data parsing if you're going to accept user-submitted content!

Tests

npm run test

Contributing

I would love your help! Please make an issue or better yet create a pull request if you find a bug or missing feature!

About

A responder function you can pass into a http.createServer to work with your frameworkless Node.js HTTP app. Supports serving static files and routes!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published