Code Monkey home page Code Monkey logo

hello's Introduction

ufront

Build Status Join the chat at https://gitter.im/ufront/ufront

Ufront is a client/server MVC web framework for Haxe. It allows you to share models, views and controllers between both server-side and client-side code. Client side, your app will run as a fast single-page-app. But everything can still work server-side - which makes for fast first page loads, great SEO, and a good fallback for old browsers.

Platform Support

  • Neko (Server side)
  • PHP (Server side)
  • NodeJS (Server side, experimental)
  • JS (Client side)

It would be possible to also support Python, Java, C# and C++ with a little work.

Installing

Installing from haxelib:

haxelib install ufront-mvc
haxelib install ufront-tool
sudo haxelib run ufront-tool --setup

Using the latest git version:

haxelib git ufront-mvc https://github.com/ufront/ufront-mvc
# Similar for other libs

To update that git repository to a newer version:

haxelib update ufront-mvc

Getting started

A "hello world" can be found in the ufront/hello repo to give you an example of how to get started. This example includes builds for Neko, PHP and NodeJS in server.hxml, and for Client JS in client.hxml.

You can also visit the ufront-nodejs-guide for a more comprensive guide.

Repos

Core:

  • ufront - This is not a library itself but just to hold some codes for generating the documentations
  • ufront-mvc - The MVC framework. Provides routing, controllers, views, APIs, remoting, dependency injection and more.

Plugins and other optional libraries:

  • ufront-tool - The helper tool for ufront.
  • ufront-orm - An ORM that makes it easy to have models with validation, serialization, automatic relationships and more.
  • ufront-easyauth - An auth system that gives you users, groups and permissions. Fairly simplistic but flexible. Easy to replace if you have different needs.
  • ufront-ufadmin - An admin area for your web-app.
  • ufront-uftasks - Easy command line tasks that integrate with your models and APIs.
  • ufront-mail - Easily send emails with Ufront.

Feel free to contribute!

hello's People

Contributors

andyli avatar jasononeil avatar kevinresol avatar nishadgupta avatar npretto avatar simn avatar yangwonlohengramm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hello's Issues

helloWorld layout

I try to figure out, where to come from helloWorld/hello.html layout.
So where is in the project is setted up the path of the layout?
Where and how can I change?

thanks

Log file not created?

I'm evaluating haxe and ufront for web development. So I'm trying this very basic example. It seems that something is missing from the steps. See below:

timothy@sardis:~/projects/hello$ ufront task --setup-tables
Called from ? line 1
Called from Tasks.hx line 22
Called from /usr/lib/haxe/std/sys/db/Transaction.hx line 57
Called from /usr/lib/haxe/std/sys/db/Transaction.hx line 44
Called from /usr/lib/haxe/std/sys/db/Transaction.hx line 32
Called from Tasks.hx line 43
Called from ufront/tasks/UFTaskSet.hx line 65
Called from /usr/lib/haxe/std/neko/_std/sys/io/File.hx line 58
Uncaught exception - [file_open,uf-content/logs/helloworld.log]

I was able to run the server but could not subscribe since it never created the tables properly.

Problems building both in windows and ubuntu

haxe and neko versions

npretto@ubuntu:~/hello$ haxe -version
3.1.3
npretto@ubuntu:~/hello$ neko
NekoVM 2.0.0 (c)2005-2013 Haxe Foundation
  Usage : neko <file>

ufront build

npretto@ubuntu:~/hello$ ufront build
Build server.hxml
/usr/lib/haxe/std/neko/_std/EReg.hx:33: characters 11-61 : Ungreedy *? are not supported in macros
<builtin>:1: character 0 : Called from
/usr/lib/haxe/std/neko/_std/EReg.hx:22: lines 22-204 : Called from
/usr/lib/haxe/lib/ufront-mvc/1,0,0-rc,10/src/neko/ufront/web/context/HttpRequest.hx:303: characters 27-45 : Called from
Aborted
Build tasks.hxml
/usr/lib/haxe/std/neko/_std/EReg.hx:33: characters 11-61 : Ungreedy *? are not supported in macros
<builtin>:1: character 0 : Called from
/usr/lib/haxe/std/neko/_std/EReg.hx:22: lines 22-204 : Called from
/usr/lib/haxe/lib/ufront-mvc/1,0,0-rc,10/src/neko/ufront/web/context/HttpRequest.hx:303: characters 27-45 : Called from
/usr/lib/haxe/std/haxe/macro/Context.hx:229: characters 9-48 : Called from
/usr/lib/haxe/std/haxe/macro/Compiler.hx:134: characters 5-26 : Called from
/usr/lib/haxe/std/haxe/macro/Compiler.hx:136: characters 5-53 : Called from
/usr/lib/haxe/lib/compiletime/2,5,1/src/CompileTime.hx:92: characters 8-72 : Called from
src/Tasks.hx:65: characters 2-34 : Called from
Aborted
Failed to build server.hxml, tasks.hxml

PDO error

From last git version, PDO raise an exception at launch :

uncaught exception: SQLSTATE[HY000] [2002] No such file or directory

in file: /Volumes/soto/eric/Taf/__lab__/haxe/haxejs/08-hello-ufront/www/php/php/db/_PDO/PDOConnection.class.php line 7
#0 /Volumes/soto/eric/Taf/__lab__/haxe/haxejs/08-hello-ufront/www/php/php/db/_PDO/PDOConnection.class.php(7): PDO-&gt;__construct('mysql:host=loca...', 'ufront', 'ufront')
#1 /Volumes/soto/eric/Taf/__lab__/haxe/haxejs/08-hello-ufront/www/php/php/db/PDO.class.php(6): php_db__PDO_PDOConnection-&gt;__construct('mysql:host=loca...', 'ufront', 'ufront', NULL)
#2 /Volumes/soto/eric/Taf/__lab__/haxe/haxejs/08-hello-ufront/www/php/sys/db/Mysql.class.php(16): php_db_PDO::open('mysql:host=loca...', 'ufront', 'ufront', NULL)
#3 /Volumes/soto/eric/Taf/__lab__/haxe/haxejs/08-hello-ufront/www/php/Server.class.php(17): sys_db_Mysql::connect(Object(_hx_anonymous))
#4 /Volumes/soto/eric/Taf/__lab__/haxe/haxejs/08-hello-ufront/www/php/Server.class.php(14): Server::run()
#5 /Volumes/soto/eric/Taf/__lab__/haxe/haxejs/08-hello-ufront/www/index.php(9): Server::main()
#6 {main}

The mysql.json is correct.
I achieve to connect from neko server with the same settings.

I build the output from haxe 3.2.0. Any issue with PDO there ?

Database connection error

I am attempting to run the ufront task command and getting this error:

Called from ? line 1
Called from Tasks.hx line 22
Called from /usr/lib/haxe/std/neko/_std/sys/db/Mysql.hx line 203
Uncaught exception - mysql.c(508) : Failed to connect to mysql server : Failed to connect on host 'localhost'

I have set up the database/user/password of ufhelloworld using PHPMyAdmin on MAMP. Restarted the servers. Tried changing mysql.json to my normal "root" user that I use, still the error.

Is this perhaps a Haxe bug?

Node remoting broken

Haxe Compiler 3.2.1
node v4.2.6
├── [email protected]
└── [email protected]

Clicking on any of the buttons on the page results in
"Error with response for ufront.auth.api.EasyAuthApi.getCurrentUser(): no remoting response found"

Directly hitting http://localhost:2987/Jason works, so there is nothing wrong with the server-side rending.

The node console outputs many lines involving favicon.ico:
[GET /favicon.ico] from [::1 The Boss], response: [200 text/html]
Trace: HelloWorldController.hello(38): Hey favicon.ico, did you know we can trace directly to the browser console?

UFClientAction example

I'm having some difficulty to understand UFClientAction, so I'd like to know if would be possible to include a simple example in this repo, maybe seting up a validation in the form.

there is already some code that verify if the name come in blank, maybe the client validation could just limit the size of the name.

Using Sqlite

How can i use Sqlite instead of mysql? Would be very useful for testing purposes and also its much lighter for small projects, thank you.

BytesData errors with 3.2.1

solved - looks like my std lib has been messed up
but now I have not been able to adapt the RewriteBase to make it work on localhost with php except keeping it at / and moving the content of www to my DocumentRoot - There I can access http://localhost/signup/newname/ and get the signup form - but sending it fails with:

Remoting API ufront.auth.api.EasyAuthApi.getCurrentUser() not found: Unable to access ufront.auth.api.EasyAuthApi.getCurrentUser - API Not Found (Invalid path ufront.auth.api.EasyAuthApi.getCurrentUser). See {}

Details
RApiNotFound(ufront.auth.api.EasyAuthApi.getCurrentUser(),Unable to access ufront.auth.api.EasyAuthApi.getCurrentUser - API Not Found (Invalid path ufront.auth.api.EasyAuthApi.getCurrentUser). See {})

How to share common classes between server and client?

Hi, the way I'm organizing i like to have multiple folders inside src directory.

  • src
    • client
    • server
    • shared

The trouble is how to share classes between server and client (example interfaces), the way i found is to add "server" and "client" packages to the files.

It has the disadvantage that its possible to import client package files into server and vice versa, for now I'm using a small check like #if client error #end on server package files.

Is there a more elegant solution for this? Thank you very much.

Cannot access http://localhost:8000/ using ufront server

If i use ufront server on projectDir, on the terminal it says:

Starting Neko Server on XXXX-PC:2987

when i try to access http://localhost:8000/ i get : Error code 102 (net::ERR_CONNECTION_REFUSED)
(also tried port 2987)

However if i use

nekotools server -rewrite -p 8000 -h localhost -d ./ 

from projectDir/www it works fine and i can view all pages.

Using windows 7 64-bit

Build problems

I am attempting to build the ufront-hello project, using the instructions on Git.

I get to the "./setupDev" part and it fails. There is no setupDev script there.
Well whatever, I say— I had it installed before so I continue with the other stuff.

I get to "cd submodules/hello" and it fails because that doesn't exist either.

From the text I assume that this part was intended to build ufront-hello. I had cloned that manually before, so I continue the instructions using those files.

In the past I ran into problems and was advised to used the git versions of the libraries. So now I have the git versions of all ufront libraries active in my haxelib. When I attempt to ufront build, first it complains of Error parsing haxelib.json for ufront@git: [file_contents,/usr/lib/haxe/lib/ufront/git/haxelib.json]
So I grabbed that from a different version in the haxelib ufront folder and removed the versions of the dependencies.

Then I build and it says Library ufront version git does not have a run script so I had to copy the run.n file also.

Then to avoid errors about having two versions installed, I had to also remove all versions from the haxelib.json files in ufront-easyauth.

Now when I compile I get:
/usr/lib/haxe/lib/ufront-mvc/1,1,0/src/ufront/api/UFAsyncApi.hx:94: lines 94-174 : Missing return tink.Surprise<_makeApiCall.A, tink.TypedError<ufront.remoting.RemotingError<_makeApiCall.B>>>
/usr/lib/haxe/lib/ufront-mvc/1,1,0/src/ufront/web/result/CallJavascriptResult.hx:99: characters 16-24 : Unknown identifier : document
/usr/lib/haxe/lib/ufront-mvc/1,1,0/src/ufront/web/result/CallJavascriptResult.hx:105: characters 15-30 : Array access is not allowed on {+ length : Int }
/usr/lib/haxe/lib/ufront-mvc/1,1,0/src/ufront/web/result/CallJavascriptResult.hx:106: characters 17-25 : Unknown identifier : document
/usr/lib/haxe/lib/ufront-mvc/1,1,0/src/ufront/web/result/CallJavascriptResult.hx:112: characters 4-12 : Unknown identifier : document
/usr/lib/haxe/lib/ufront-mvc/1,1,0/src/ufront/web/result/CallJavascriptResult.hx:113: characters 4-12 : Unknown identifier : document
Failed to build client.hxml, server.hxml

Error building sever.hxml with ufront-mv rc.17

Hello
I get the following error when i try to build server.hxml with ufront-mvc set to 1.0.0-rc.17

C:\HaxeToolkit\haxe\lib/ufront-easyauth/1,0,0-rc,10/src/ufront/auth/EasyAuth.hx:16: lines 16-194 : Field asAuthHandler needed by ufront.auth.UFAuthHandler is missing

I can build server.hxml with ufront-mvc set to rc.15 but then obviously i can't build client.hxml which needs rc.17
I'm using ufront libraries set to:

ufront-client: git [dev:C:\HaxeToolkit\haxe\lib/ufront-client/git]
ufront-clientds: [1.0.0-beta.9]
ufront-easyauth: [1.0.0-rc.10]
ufront-mail: [1.0.0-rc.4]
ufront-mvc: 1.0.0-rc.12 1.0.0-rc.15 [1.0.0-rc.17] 1.0.0-rc.9
ufront-orm: [1.0.0-rc.11]
ufront-ufadmin: [1.0.0-beta.11]
ufront-uftasks: [1.0.0-beta.12] 1.0.0-beta.13
ufront: [1.0.0-rc.13]

I don't understand why it tries to cast to EasyAuth - i don't use the ufront_easyauth directive it should use YesBossAuthHandler from the default configuration - ???

Any ideas what I can do to compile both server and client, without having to switch mvc versions in between?

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.