Giter Site home page Giter Site logo

balde / balde Goto Github PK

View Code? Open in Web Editor NEW
725.0 22.0 39.0 1.01 MB

A microframework for C based on GLib.

Home Page: https://balde.rgm.io/

License: GNU Lesser General Public License v2.1

Shell 2.22% C 91.33% CSS 0.01% JavaScript 0.01% HTML 0.55% Makefile 4.65% M4 1.13% Dockerfile 0.06% Dockerfile 0.06%

balde's Introduction

balde

Build Status

This is balde, a microframework for C based on GLib.

It is designed to be fast, simple, and memory efficient. Most of its architecture is based on other microframeworks, like Flask, and it can run on any web server that supports CGI and/or FastCGI.

balde is free software, released under the LGPL2 license.

For more information, take a look at:

balde's People

Contributors

jaysonsantos avatar jubalh avatar rafaelmartins avatar timgates42 avatar wiliamsouza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

balde's Issues

undefined reference to `balde_make_response'

With this Dockerfile (forked from the original to include the compilation step), I get a series of errors upon the compilation step.

Following the documentation, this is what is expected in order to compile a sample application.

It appears that possible balde isn't being brought in correctly as a library, is there a step missed in the container setup?

Output:

/tmp/ccVwsoS7.o: In function `hello':
main.c:(.text+0x16): undefined reference to `balde_make_response'
/tmp/ccVwsoS7.o: In function `main':
main.c:(.text+0x2c): undefined reference to `balde_app_init'
main.c:(.text+0x51): undefined reference to `balde_app_add_url_rule'
main.c:(.text+0x5d): undefined reference to `balde_app_run'
main.c:(.text+0x69): undefined reference to `balde_app_free'
collect2: error: ld returned 1 exit status

Dockerfile:

FROM ubuntu:14.04
MAINTAINER Rafael G. Martins <[email protected]>

ENV version=0.1.2

RUN apt-get update && apt-get install -y \
    pkg-config gettext zlib1g-dev libffi-dev \
    autoconf automake build-essential libtool libxml2-utils \
    libfcgi-dev shared-mime-info libglib2.0-dev wget peg ca-certificates \
    --no-install-recommends && apt-get clean

RUN wget https://github.com/balde/balde/releases/download/v${version}/balde-${version}.tar.xz && tar xvf balde-${version}.tar.xz

RUN cd balde-${version} && \
    ./autogen.sh && \
    ./configure --prefix=/usr && \
    make && \
    make install

COPY . /usr/src/workspace
WORKDIR /usr/src/workspace
RUN gcc -o app $(pkg-config --libs --cflags balde) main.c
CMD ["./app"]

Source:

#include <balde.h>

balde_response_t*
hello(balde_app_t *app, balde_request_t *request)
{
    return balde_make_response("Hello World! I'm the balde! :D");
}

int
main(int argc, char **argv)
{
    balde_app_t *app = balde_app_init();
    balde_app_add_url_rule(app, "hello", "/", BALDE_HTTP_GET,
        hello);
    balde_app_run(app);
    balde_app_free(app);
    return 0;
}

Desenvolvimento no Windows

Olá,
sou programador de PHP, mas vi esta microframework e achei interessante. Achei que podia ser útil no caso de querer aprender a desenvolver em C, seja aplicações web ou outras coisas, porque sempre ouvi falar muito bem de C.

Gostava de saber se é possível, e se sim como, posso utilizar esta microframework em ambiente Windows :)

Obrigado,
Abraços.

Examples Fail

I followed instructions here: https://balde.rgm.io/doc/getting-started.html

I built balde with examples, but running them as specified in the above documentation gives the following:


balde-0.1.2/examples$ ./hello --runserver
Status: 405 Method Not Allowed
Content-Type: text/plain; charset=utf-8
Content-Length: 73

405 Method Not Allowed

The method is not allowed for the requested URL.


with the exception of hello-with-static which gives the following:


balde-0.1.2/examples$ ./hello-with-static --runserver
Status: 404 Not Found
Content-Type: text/plain; charset=utf-8
Content-Length: 136

404 Not Found

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.


The same errors occur with or without --runserver.

make check fails

here is my issue:

On OS X El Capitan v10.11.4

$ make check
/Applications/Xcode.app/Contents/Developer/usr/bin/make  check-recursive
Making check in artwork
make[2]: Nothing to be done for `check'.
Making check in libbalde
make[2]: Nothing to be done for `check'.
Making check in libbalde_template
make[2]: Nothing to be done for `check'.
Making check in include
Making check in balde
make[3]: Nothing to be done for `check'.
Making check in balde-template
make[3]: Nothing to be done for `check'.
make[3]: Nothing to be done for `check-am'.
Making check in bin
make[2]: Nothing to be done for `check'.
Making check in examples
make[3]: Nothing to be done for `check-am'.
Making check in doc
make[2]: Nothing to be done for `check'.
Making check in tests
Making check in static
make[3]: Nothing to be done for `check'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make  check_app check_exceptions check_resources check_routing check_stdin check_template check_template_helpers check_wrappers
  CC     check_app.o
  CCLD   check_app
  CC     check_exceptions.o
  CCLD   check_exceptions
  GEN    resources.c
  GEN    resources.h
  CC     check_resources.o
  CC     resources.o
  CCLD   check_resources
  CC     check_routing.o
  CCLD   check_routing
  CC     check_stdin.o
  CC     mock_getc.o
  CCLD   check_stdin
  CC     check_template.o
  CCLD   check_template
  CC     check_template_helpers.o
  CCLD   check_template_helpers
  CC     check_wrappers.o
  CC     mock_datetime.o
  CCLD   check_wrappers
/Applications/Xcode.app/Contents/Developer/usr/bin/make  check-TESTS
/app/init: OK
/app/set_config: OK
/app/get_config: OK
/app/add_url_rule: OK
/app/get_view_from_endpoint: OK
/app/get_view_from_endpoint_not_found: OK
/app/url_for: OK
/app/url_for_with_script_name: OK
PASS: check_app
/exceptions/get_name_from_code: OK
/exceptions/get_name_from_code_not_found: OK
/exceptions/get_description_from_code: OK
/exceptions/get_description_from_code_not_found: OK
/exceptions/abort_set_error: OK
/exceptions/abort_set_error_with_description: OK
/exceptions/abort: OK
/exceptions/abort_with_description: OK
PASS: check_exceptions
/resources/list_files: OK
/resources/load: OK
PASS: check_resources
/routing/url_match: OK
/routing/url_match_with_variable: OK
/routing/url_match_with_null_path: OK
/routing/url_match_with_empty_path: OK
/routing/url_match_without_trailing_slash: OK
/routing/url_match_without_trailing_slash_with_variable: OK
/routing/url_match_with_multiple_matches: OK
/routing/url_match_with_path: OK
/routing/url_no_match: OK
/routing/url_no_match2: OK
/routing/url_rule_with_path: OK
/routing/url_rule: OK
/routing/url_rule_not_found: OK
/routing/url_rule_with_multiple_methods: OK
/routing/http_method_str2enum: OK
/routing/list_allowed_methods: OK
/routing/parse_url_rule: OK
PASS: check_routing
/stdin/read: OK
/stdin/stream: **
ERROR:check_stdin.c:48:test_stream: assertion failed (request->stream == "guda=bola&moises=arcoiro"): (NULL == "guda=bola&moises=arcoiro")
/bin/sh: line 1: 58926 Abort trap: 6           ${dir}$tst
FAIL: check_stdin
/template/generate_source_without_vars: OK
/template/generate_source_single_var: OK
/template/generate_source_single_var_with_includes: OK
/template/generate_source_multiple_vars: OK
/template/generate_source_multiple_vars_and_lines: OK
/template/generate_source_multiple_vars_and_lines_with_function_calls: OK
/template/generate_source_with_percent: OK
/template/generate_header: OK
/template/get_name: OK
/template/parse: OK
PASS: check_template
/template_helpers/url_for: OK
/template_helpers/url_for_with_script_name: OK
PASS: check_template_helpers
/wrappers/make_response: OK
/wrappers/make_response_len: OK
/wrappers/make_response_from_exception: OK
/wrappers/make_response_from_exception_not_found: OK
/wrappers/make_response_from_external_exception: OK
/wrappers/response_set_headers: OK
/wrappers/response_append_body: OK
/wrappers/response_append_body_len: OK
/wrappers/fix_header_name: OK
/wrappers/response_set_tmpl_var: OK
/wrappers/response_get_tmpl_var: OK
/wrappers/response_set_cookie: OK
/wrappers/response_set_cookie_with_expires: OK
/wrappers/response_set_cookie_with_max_age: OK
/wrappers/response_set_cookie_with_expires_and_max_age: OK
/wrappers/response_set_cookie_with_path: OK
/wrappers/response_set_cookie_with_domain: OK
/wrappers/response_set_cookie_with_secure: OK
/wrappers/response_delete_cookie: OK
/wrappers/response_render: OK
/wrappers/response_render_with_custom_mime_type: OK
/wrappers/response_render_with_multiple_cookies: OK
/wrappers/response_render_without_body: OK
/wrappers/response_render_exception: OK
/wrappers/response_render_exception_without_body: OK
/wrappers/request_headers: OK
/wrappers/urldecode: OK
/wrappers/parse_query_string: OK
/wrappers/parse_cookies: OK
/wrappers/make_request: OK
/wrappers/request_get_header: OK
/wrappers/request_get_arg: OK
/wrappers/request_get_form: OK
/wrappers/request_get_form_with_empty_body: OK
/wrappers/request_get_view_arg: OK
/wrappers/request_get_cookie: OK
PASS: check_wrappers
===============================================
1 of 8 tests failed
Please report to https://github.com/balde/balde
===============================================
make[4]: *** [check-TESTS] Error 1
make[3]: *** [check-am] Error 2
make[2]: *** [check-recursive] Error 1
make[1]: *** [check-recursive] Error 1
make: *** [check] Error 2

lack of documentation

Just found that code is lack of documentation, do you guys interesting in some document generating tools like doxygen to doc the code ?

Status: 405 Method Not Allowed in balde-0.1.2 release

After run examples: ./hello --runserver I have no * Running on http://127.0.0.1:8080/ (threads: 10)

menan@ubuntu-server:~/c/balde/examples$ **./hello** --runserver
Status: 405 Method Not Allowed
Content-Type: text/plain; charset=utf-8
Content-Length: 73

405 Method Not Allowed

and app exit

On Ubuntu 16.04 x64

libglib2.0-dev: 2.48.0-1ubuntu4
libfcgi-dev: 2.4.0-8.3

Can we get a CMake build file?

I'd love to toy with this and just have it as a submodule on my toy project and be able to build it along side with my code.

Can't complete installation - pkg

I am unable to complete installation on CentOS 7 due to some dependencies which are undocumented. I install balde binaries with fastcgi dependencies. I install pkgconfig but your package does not explain how to complete the path setup. While I compile your example codes, it won't run. Please help.

Here're my installation steps

1. download balde
https://github.com/balde/balde/releases
or simply download the tar file https://github.com/balde/balde/releases/download/v0.1.2/balde-0.1.2.tar.gz

2. install fastcgi

sudo yum install gcc gcc-c++ autoconf automake
sudo yum install fcgi-devel spawn-fcgi

then cd to balde binary
./configure

3. install pkg-config
https://www.freedesktop.org/wiki/Software/pkg-config/

sudo ./configure && sudo make && sudo make install

export PKG_CONFIG_PATH=/home/ray/dev/balde/pkg-config-0.29.1

gcc -o hello $(pkg-config --libs --cflags balde) hello.c
Package balde was not found in the pkg-config search path.
Perhaps you should add the directory containing 'balde.pc'
to the PKG_CONFIG_PATH environment variable
No package 'balde' found
hello.c:16:19: fatal error: balde.h: No such file or directory
 #include <balde.h>
                   ^
compilation terminated.

can't compile test

On OS X El Capitan v10.11.4

Here is my code: test.c

#include <stdio.h>
#include <balde.h>

int main() {
    return 0;
}

outputs

$ gcc test.c -o test
In file included from test.c:2:
In file included from /usr/local/include/balde.h:12:
/usr/local/include/balde/app.h:12:10: fatal error: 'glib.h' file not found
#include <glib.h>
         ^
1 error generated.

I ran configure, make, sudo make install and everything went smoothly (except for make check which I created an issue for just before this one)

edit: I also wanted to say I for sure have glib ;) I also tried linking it with no luck

Stable release

Hi!
I'm taking interest in this project since a couple of years.

Do you plan to make a new release at some point? The last one was already quite some years ago and it seems there have been plenty of changes.

Best,
Michael

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.