Coder Social home page Coder Social logo

bennyschmidt / node-express-api Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 28 KB

A fast, declarative, and flexible library for building RESTful APIs.

Home Page: https://www.npmjs.com/package/node-express-api

License: Other

JavaScript 100.00%
node api express wrapper node-framework backend-framework backend-library flexible-library

node-express-api's Introduction

Node Express API

A fast, declarative, and flexible library for building RESTful APIs.

Define a new API

class userApi extends NodeExpressApi {

  constructor() {
    const options = {
      redirectToHttps: true,
      wsConnection: false
    };

    const requests = [
      { type: 'get', path: '/', handler: 'renderStatusPage' },
      { type: 'post', path: '/user', handler: 'createUser' },
      { type: 'get', path: '/user', handler: 'getUser' },
      { type: 'put', path: '/user', handler: 'updateUser' },
      { type: 'delete', path: '/user', handler: 'deleteUser' }
    ];

    super(requests, options);
  }

  createUser(req, res) { }

  getUser(req, res) { }

  updateUser(req, res) { }

  deleteUser(req, res) { }

}

Render a status page

Handle the desired status page route with with the renderStatusPage method:

{ type: 'get', path: '/', handler: 'renderStatusPage' }

Run the API

node api

node-express-api's People

Contributors

bennyschmidt avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

dexit

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.