Coder Social home page Coder Social logo

expressr's Introduction

Express Request Parser

This handy middleware:

  • parses multipart requests,

  • parses json requests,

  • parses urlencoded requests,

  • adds a bunch of useful methods to coerce request parameters:

    • req.getString retrieves a string (or an empty string if no parameter found)
    • req.getStrings retrieves an array of strings (or an empty array if no parameter found)
    • req.getInteger retrieves an integer (or 0 if not an integer)
    • req.getIntegers retrieves an array of integers (skipping non-integers)
    • req.getNumber retrieves a number (or 0 if not an number)
    • req.getNumbers retrieves an array of numbers (skipping non-numbers)
    • req.getMoment parses a string date in YYYY-MM-DD format (or default value)
    • req.getMoments parses an array of moment dates (skipping invalid ones)
    • req.getFile retrieves a file parsed from multipart form
    • req.getFiles retrieves an array of files

Each file is represented by an object with following keys:

  • name — original filename as submitted by user with slashes and semicolons removed;
  • safeName — filename converted to ASCII to be safely stored in virtually any FS;
  • type — value of Content-Type header as submitted by browser;
  • path — path to temporary storage so that you could move it to its final place with fs.rename(file.path, destination, cb).

expressr's People

Contributors

ryuugan avatar

Watchers

Boris Okunskiy avatar James Cloos avatar

Forkers

ryuugan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.