Giter Site home page Giter Site logo

webgs's Introduction

WebGS

WebGS is a framework for building the back-end for modern web applications in GemStone/S 64 Bit Smalltalk. It provides a basic server and can respond to HTTP requests with Smalltalk-generated strings. While these strings can be HTML, in today's environment it is more common that they will be JSON.

Install

Install WebGS with Topaz (see installWebGS.sh and .topazini for an example of how to do this).

Use

The typical use is to subclass WebApp and override appropriate methods. To see how this works, take a look at Sample.gs. This application will be run by the installWebGS.sh script as part of the initial install or you can run the application from a Topaz prompt or from an IDE (such as Jade) using Sample runHttp. If you have breakpoints or halts in your code, then the server will stop and you can debug the code (or just step through it to see how it works). To test the server, access it from a web browser (http://localhost:8888) or from a Linux or macOS shell:

curl http://localhost:8888/stone.gs
curl --header "Content-Type: application/json" \
   --request POST \
   --data '{"x":3,"y":5}' \
   http://localhost:8888/add.gs \
   && echo
curl http://localhost:8888/README.md

Of course, simple GET requests can be submitted from a browser and Postman is a great tool for working with web servers.

WebSockets

Sample.gs also has a demo of how to use WebSockets.

Please keep in mind that all your WebSocket connections on this host/port will be sharing the same gem and the connections will stay alive until they are dropped by the client. (While the current implementation will respond to a ping, it does not initiate a ping and disconnect clients who fail to respond.) This may affect performance (depending on how much activity each connection requires) and it may affect behavior (think very carefully about commits and aborts!).

Tests

WebGS includes a set of tests written in Dart. This also provides an example of how to interact with WebGS from a client application.

webgs's People

Stargazers

Luciano Martínez avatar Jonathan van Alteren avatar  avatar  avatar Francisco Ortiz Peñaloza avatar

Watchers

 avatar Craig Latta avatar James Foster avatar  avatar Larry Trutter avatar  avatar  avatar

webgs's Issues

Question: Class definition for HttpConcurrentServer

Hello James,

you have exported the methods for the class HttpConcurrentServer (/src/HttpConcurrentServer.gs), but i can't find any Class definition in the /src/WebGs.gs file or any hints in the *.sh files.

Did i overlook somethink, is it a default class in GemStone64Bit3.6.6?

Regards
Peter

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.