Suneido

Integrated Application Platform

  • Home
  • Learning
    • Suneido Manual
    • Beginners
      • Inside Suneido
      • The Suneido Programming Language
      • The Suneido Database
      • Installing Suneido
      • Building Suneido
      • IDE Go To Tour
      • Upgrading To A New Release
    • Advanced
      • Canvas Control
      • DrawControl Part 1
      • DrawControl Part 2
      • DrawControl Part 3
      • SAX Like XML Processing
      • A Plug-In Architecture
      • A Simple Wizard Framework
      • An HTML Include Facility
      • An RSS 2 Feed Creator
      • MIME Generation
      • A New Add-on Facility
      • Workspace Improvement Hack
    • Mockito for Suneido
    • The Suneido Task Scheduler
    • Contributing To Suneido
    • Contributor Assignment of Copyright
    • Language Translation
    • Future Directions
    • Interview With Andrew Mckinlay
  • Forum
    • Announcements
    • Internals & Enhancements
    • Cookbook
    • General
  • FAQ
  • Screenshots
  • Downloads
  • Links

Razor

Integrated Application Platform › Forums › General › Razor

  • This topic has 4 replies, 3 voices, and was last updated 3 years, 5 months ago by joshob.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • August 10, 2019 at 8:53 am #1474
    joshob
    Participant

    Hi,

    Would be possible to show me a sample code with razor and RackServer please.

    Have a nice day and thank you for your reply.

    Regards

    Joshob

    August 10, 2019 at 9:54 am #1475
    amckinlay
    Keymaster

    Our applications are large but I’ll see if I can come up with a small example.

    August 11, 2019 at 6:11 am #1476
    joshob
    Participant

    Thanks for your reply.

    All I want to know is how I can query a database and display the result with RackServer and Razor.

    Have a nice day !

    joshob

    August 13, 2019 at 1:41 pm #1477
    hao_xie
    Participant

    Here is a simple Rack server listing all the database table names

    class
    	{
    	CallClass(port = 80)
    		{
    		RackServer(app: RackRouter(.routes()), with: [RackLog], :port)
    		}
    	routes()
    		{
    		return [['GET', '/tables$', .tables]]
    		}
    	tables(env/*unused*/)
    		{
    		content = QueryList("tables", 'tablename')
    		return Razor(.template, [:content])
    		}
    	template: '
    <html>
    	<head lang="en"><meta charset="UTF-8"></head>
    	<body>
    		<h1>Tables</h1>
    		@for(line in .content)
    			{
    			<div>@line</div>
    			}
    	</body>
    </html>'
    	}

    To start the server, you just need to call the class name of this code in workspace. After launching the server, you can visit “http://127.0.0.1/tables&#8221; to see the page.

    August 14, 2019 at 6:36 pm #1478
    joshob
    Participant

    hao_xie

    Thank you very much for your code. It’ll be useful and I’ll can learn from it.

    Regards,

    Joshob

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

Search Forums

Log In
Welcome to the new Suneido Web Site and Forum.
Register
Lost Password
users of the previous PHPBB Forum should be able to log in with their previous username and password.

Recent Topics

  • Alpha copy of gSuneido to play with
  • how to start jsuneido ?
  • Problem Starting Suneido…
  • Dialog not showing buttons
  • New link for Suneidojo

Contact Us | Legal Statement | Privacy Statement | SiteMap

Copyright © 2023 Axon® Development Corporation. All Rights Reserved. - Open Source Integrated Database and Programming Language