GithubHelp home page GithubHelp logo

asp-101's Introduction

Clasic ASP 101

Assumption

  • Basically, Classic ASP is just like a SSR technology, which allows us to embed some server scripts using <%>, just like we do with <script/> in HTML & NextJS

Programming language

You can use either VBScript by default or use Javascript

How to use

  1. Specify Scripting Lang. This must be specified before every route

    <%@ Language= "Javascript" %>
  2. Import other .asp files

    <-- #include file="relative\filename.asp" -->
    <-- #include virtual="\absolute\filename.asp" -->
  3. Parsing JSON body

    <!-- #include file="utils\json.asp" -->
    <%
        var body = BindJSONBodyToObject(Request)
    %>
  4. Parsing QueryString to JS Object

    var queries = BindQueryToObject(req)
  5. RestWrapper - Sample Router

    • Default Error handling
    • Auto JSON Serialization/Deserialization
    • Parsing Body, Query

    x Connection pool, db rows -> object (object mapping) x Rewrite URL x object -> VB, Request Methods, Data validation x logging

    <!-- #include virtual="\rest\rest.asp" -->
    var handler = function (req,res) {
        var queries = BindQueryToObject(req)
    
        if(!queries){
            // queries not exists or empty
    
            throw new HttpError("Missing query", 400)
        } else {
            var responseObj = {
                content: "Rest API server"
            }
    
            return responseObj
        }
    }
    RestWrapper(Request,Response, handler)

References

53636fa7ad0c5c3812b8fef77d288c4cfb190c27

asp-101's People

Contributors

thinhlh avatar

Watchers

 avatar

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.