Skip to content
A command line tool to help you get going with UFront - a MVC server framework for haxe web apps.
Haxe
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
resource
src
templates
.gitignore
.mlib
README.md
UFTool.sublime-project
UFTool.sublime-workspace
build.hxml
haxelib.xml

README.md

UFTool - A tool to help set up UFront projects quickly

** PLEASE NOTE: this readme refers largely to the plan, not the reality. Most of this doesn't work yet. Sorry! **

A few tips for UFront and UFtool

UFront is web framework for the haxe language, and it compiles to PHP, Neko and soon hopefully NodeJS. It is an MVC framework, meaning you structure you code as Models (the data structure, validation and database interaction), Views (the templates) and Controllers (where stuff actually happens). This allows you to write Web Apps that can grow in complexity as the project requires, without things getting out of hand.

UFtool is a simple tool to help get you up and running with UFront faster. Here are some of the commands

haxelib run uftool init myproject

Initialises a new project called 'myproject'. It will create a directory and give you a basic skeleton of files to use.

haxelib run uftool createmodel Client
haxelib run uftool -m Client

Creates a model called "client" for the current project. Models are based on haxe's SPOD framework, so they integrate into your database pretty easily.

Creates a new controller called "InvoicingController". Each controller has a set of actions, which perform a separate action and render output to the client.

haxelib run uftool createcontroller -scaffold Client
haxelib run uftool -c -scaffold Client

This creates a controller based on "Scaffolding" for a model. Scaffolding, like in real life, allows you to quickly throw together a basic structure while you build something more permanent around it. For Web Projects, this usually means meeting these basic functions

  • Create
  • Read
  • Update
  • Delete
  • List
  • Search

The "Scaffolding" we use here creates these basic functions for a given model. For example, if we set up scaffolding for out client model, the framework will automatically generate these functions:

  • Create a new client
  • Show a specific client
  • Update the details for a client
  • Delete a client
  • List all clients
  • Search all clients using a specific field

This is handy for getting up and running quickly!

haxelib run uftool server
haxelib run uftool -s

This compiles your project using "build.hxml", and load nekotools server to start up a local server for the current project. The server will be available by visiting http://localhost:2000 in a web browser.

Syntax to use: nekotools server -p 2000 -h localhost -d c:\your\web\root\ -rewrite

Database Setup

By default our init tool uses MySQL. SQLite might be preferable for a quick setup, but I'm not sure how many of the SPOD Macro features work on it. Will have to play... For now I'll try to make the MySQL setup as painless as possible.

Anyway, basically, these are the commands we run in init

CREATE USER 'username'@'server' IDENTIFIED BY 'password';

GRANT USAGE ON * . * TO 'username'@'server' IDENTIFIED BY 'password' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;

CREATE DATABASE IF NOT EXISTS `database` ;

GRANT ALL PRIVILEGES ON `database` . * TO 'username'@'server';
Something went wrong with that request. Please try again.