Coder Social home page Coder Social logo

jst's Introduction

JST

Jst writing for build web page like PHP. All your Javascript codes runs in V8 engine. So, faster.

Now you can use variables and print this variables, require modules , own modules and another pages.

Installing

Clone this repository, build pages on www ( page.jst ) and enjoy!

Examples

<?jst
    const title = "test page";
    const content = "test content";
?>
<html>
    <head>
        <title><?jst
            print(title);
        ?></title>
    </head>
    <body>
        <?jst
            print(content);
        ?>
        <img src="/test.png" />
    </body>
</html>

POST, GET and HEADERS usage

You can use POST, GET and HEADERS variables

POST

<?jst
    print(POST.name)
?>

GET

<?jst
    print(GET.name)
?>

HEADERS

<?jst
    print(HEADERS.Authorization);
    print(HEADERS["Content-Type"]);
?>

Using MySQL

You can use MySQL. We are added mysql-promise package for MySQL support.

Example :

<?jst
    const query = await mysql.query("SELECT * FROM test");
    const [rows] = query;
    for(let i=0; i < rows.length; i++){
        print(rows[i].name);
    }


?>

Require other modules or pages

For Async pages :

    await require("./other-async-page.jst");

For Standart Modules :

    const moment = require("moment");

You can pass data to required page

    const data = "test data";
    await require("./partial-page.jst", {data});

partial-page.jst

<?jst
    print(data);
?>

Console

You can use console


console.log("some console write");

Contributors

Now just me :D. You can send me pull request for contibution.

jst's People

Contributors

mustafa-colakoglu avatar dependabot[bot] avatar

Stargazers

Adem Ali Durmuş avatar Ethem Turgut avatar Kasim avatar Samet Palitci avatar Mücahit Topal avatar Fatih Büyük avatar Erdinç avatar gnc avatar Yüksel Güzel avatar  avatar Enes Can Güneş avatar Muhammed Kadir Tan avatar

Watchers

James Cloos avatar Erdinç avatar  avatar

jst's Issues

Wrong parse

when use ?> in any method or something, getting error

Example :

<?jst
print("?>");
?>

Example response :

image

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.