From 60cffdd4c3c7a44d9359e93cf4ae5330158aaf95 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 19 Dec 2016 14:37:14 -0600 Subject: [PATCH] web: Deprecate current web system. The web system needs a rewrite, so officially deprecating, but keeping code around in a file for reference. * 8sync/systems/web-deprecated.scm: Renamed from 8sync/systems/web.scm. * demos/hello-web.scm: Removed. * Makefile.am: Remove references to above. --- 8sync/systems/{web.scm => web-deprecated.scm} | 0 Makefile.am | 2 - demos/hello-web.scm | 73 ------------------- 3 files changed, 75 deletions(-) rename 8sync/systems/{web.scm => web-deprecated.scm} (100%) delete mode 100755 demos/hello-web.scm diff --git a/8sync/systems/web.scm b/8sync/systems/web-deprecated.scm similarity index 100% rename from 8sync/systems/web.scm rename to 8sync/systems/web-deprecated.scm diff --git a/Makefile.am b/Makefile.am index 552b62b..654de77 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,7 +48,6 @@ SOURCES = \ 8sync/agenda.scm \ 8sync/repl.scm \ 8sync/systems/irc.scm \ - 8sync/systems/web.scm \ 8sync/systems/actors.scm \ 8sync/systems/actors/debug.scm @@ -76,7 +75,6 @@ EXTRA_DIST = \ tests/utils.scm \ demos/run-demo.sh \ demos/ircbot.scm \ - demos/hello-web.scm \ demos/actors/botherbotherbother.scm \ demos/actors/simplest-possible.scm \ demos/actors/robotscanner.scm diff --git a/demos/hello-web.scm b/demos/hello-web.scm deleted file mode 100755 index af8bd9d..0000000 --- a/demos/hello-web.scm +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/guile \ --e main -s -!# - -;;; 8sync --- Asynchronous programming for Guile -;;; Copyright (C) 2015 Christopher Allan Webber -;;; -;;; This file is part of 8sync. -;;; -;;; 8sync is free software: you can redistribute it and/or modify it -;;; under the terms of the GNU Lesser General Public License as -;;; published by the Free Software Foundation, either version 3 of the -;;; License, or (at your option) any later version. -;;; -;;; 8sync is distributed in the hope that it will be useful, -;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;;; GNU Lesser General Public License for more details. -;;; -;;; You should have received a copy of the GNU Lesser General Public -;;; License along with 8sync. If not, see . - -(use-modules (8sync systems web) - (8sync agenda) - (web request) - (web response) - (web uri) - (ice-9 match)) - - -;;; Utilities -;;; ========= - -(define (simple-404 request request-body) - (values (build-response - #:code 404 - #:headers '((content-type . (text/plain)))) - "Not found. Dag, yo.")) - - - -;;; Views -;;; ===== - -(define (hello-world-view request request-body) - (values '((content-type . (text/plain))) - "Hello world!")) - - - -;;; Dispatch / routing -;;; ================== - -(define (web-dispatch request request-body) - (define (call-view view) - (view request request-body)) - ;; URI routing here - (match (split-and-decode-uri-path (uri-path (request-uri request))) - ;; This is for the `/' root - (() (call-view hello-world-view)) - ;; An example of an inline view at `/pants/' - (("pants") - (values '((content-type . (text/plain))) - "Hello pants!")) - (_ - (call-view simple-404)))) - - - -;;; CLI -;;; === - -(define main (make-web-demo-cli #:handler (wrap-apply web-dispatch))) -- 2.31.1