Re: vibe-d REST API: POSTing a struct

2023-12-17 Thread bomat via Digitalmars-d-learn
On Friday, 15 December 2023 at 07:36:04 UTC, aj_dlang wrote: does it active? If you mean if that vibe-d forum is still active, I don't know. I tried to register, but I never got a confirmation mail... so probably not. On the other hand, there wasn't a response to my question on this board ei

Re: vibe-d REST API: POSTing a struct

2023-12-14 Thread aj_dlang via Digitalmars-d-learn
On Saturday, 2 December 2023 at 12:39:01 UTC, bomat wrote: On Friday, 1 December 2023 at 19:18:19 UTC, bomat wrote: So my question is, is it possible to have vibe-d parse the request body into a struct "implicitly"? I'm gonna answer my own question here, it's `@bodyParam`. https://forum.reject

Re: vibe-d REST API: POSTing a struct

2023-12-02 Thread bomat via Digitalmars-d-learn
On Friday, 1 December 2023 at 19:18:19 UTC, bomat wrote: So my question is, is it possible to have vibe-d parse the request body into a struct "implicitly"? I'm gonna answer my own question here, it's `@bodyParam`. https://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/40001/ h

vibe-d REST API: POSTing a struct

2023-12-01 Thread bomat via Digitalmars-d-learn
Hey everyone, I'm looking into vibe-d, particularly how to build a REST API server. Given this struct: ``` struct Project { string project_id; string name; } ``` I could write a GETter like this: ``` @path("projects/:project_id") Project getProject(string _project_id);

how to set REST path for gcloud api in vibe.d?

2022-06-14 Thread MichaelBi via Digitalmars-d-learn
I need to use gcloud NLP api which has the url and endpoint like this "https://language.googleapis.com/v1beta2/documents:analyzeSentiment";. The ":" between documents and analyzeSentiment make a lot trouble for me. Just don't know how to setup the @path in RestInterface for such endpoint. I tried

[vibe.d] How to create authentication system via REST interface?

2019-09-17 Thread Pablo De Nápoli via Digitalmars-d-learn
https://forum.dlang.org/post/bctojiyzicxaueqgm...@forum.dlang.org On Wednesday, 15 March 2017 at 13:24:07 UTC, NX wrote: I'm trying to understand how to create some json-rest api that would return data (in json format) related to that specific logged in user. I see the documentation c

Re: vibe.d: problematic "Non-@safe methods are deprecated in REST interfaces"

2018-07-11 Thread Jonathan M Davis via Digitalmars-d-learn
have problems, but if you've verified all of your code and marked it as @trusted, then the compiler can check the rest of your code, and if there _is_ a memory corruption problem, you know where to look - any @trusted code and then any libraries you're using. But if you just give up and le

Re: vibe.d: problematic "Non-@safe methods are deprecated in REST interfaces"

2018-07-11 Thread Piotr Mitana via Digitalmars-d-learn
On Tuesday, 10 July 2018 at 13:24:43 UTC, WebFreak001 wrote: It's supposed to make webservers safe and not crash because of segmentation faults, etc. If you still want to write code like you are used to and don't care about that in your webserver, just mark everything in the implementation @t

Re: vibe.d: problematic "Non-@safe methods are deprecated in REST interfaces"

2018-07-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, 10 July 2018 07:24:43 MDT WebFreak001 via Digitalmars-d-learn wrote: > On Tuesday, 10 July 2018 at 13:14:24 UTC, Piotr Mitana wrote: > > Hello, > > > > I've recently started building a little REST application on > > vibe.d. I decided to use the

Re: vibe.d: problematic "Non-@safe methods are deprecated in REST interfaces"

2018-07-10 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 10 July 2018 at 13:14:24 UTC, Piotr Mitana wrote: Hello, I've recently started building a little REST application on vibe.d. I decided to use the "database" library, as I need to communicate with the PostgreSQL instance. During the compilation I see the deprecatio

vibe.d: problematic "Non-@safe methods are deprecated in REST interfaces"

2018-07-10 Thread Piotr Mitana via Digitalmars-d-learn
Hello, I've recently started building a little REST application on vibe.d. I decided to use the "database" library, as I need to communicate with the PostgreSQL instance. During the compilation I see the deprecation warning: "Non-@safe methods are deprecated in REST

Re: VibeD Rest Interface Generator

2018-03-04 Thread aberba via Digitalmars-d-learn
On Saturday, 3 March 2018 at 02:32:11 UTC, Mario wrote: So I've been learning D since the day 11 (I posted for first time here) and now I've decided to try Vibe.D to make my company API. The fact is that I've achieved to do it (according to the provided code) and it works! But it shows a defa

Re: VibeD Rest Interface Generator

2018-03-03 Thread Johannes Loher via Digitalmars-d-learn
On Saturday, 3 March 2018 at 02:32:11 UTC, Mario wrote: So I've been learning D since the day 11 (I posted for first time here) and now I've decided to try Vibe.D to make my company API. The fact is that I've achieved to do it (according to the provided code) and it works! But it shows a defa

VibeD Rest Interface Generator

2018-03-02 Thread Mario via Digitalmars-d-learn
So I've been learning D since the day 11 (I posted for first time here) and now I've decided to try Vibe.D to make my company API. The fact is that I've achieved to do it (according to the provided code) and it works! But it shows a default message and on the startup. So I'd like to know how c

Re: Vibe.d rest & web service?

2018-02-08 Thread Nicholas Wilson via Digitalmars-d-learn
index() { ... } } auto myI = new MyInterfaceImpl; router.registerRestInterface(myI); router.get("/route/to/getPage", &myI.getPage); router.get("/route/to/index", &myI.index); This worked for me, but note that my "non-rest" function was static, so I didn't

Re: Vibe.d rest & web service?

2018-02-08 Thread Nicholas Wilson via Digitalmars-d-learn
an interface to that the rest interface would actually compile, the web interface is routed before the rest interface and so the rest interface would never be reached since the methods are all the same and the REST's are shadowed by the web's . Makes me wonder whether or not vibe

Re: Vibe.d rest & web service?

2018-02-08 Thread Arjan via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 20:23:10 UTC, Nicholas Wilson wrote: On Wednesday, 7 February 2018 at 19:50:31 UTC, Jacob Carlborg wrote: Have you tried this? No. But apart from the fact that I forgot to make the class inherit from an interface to that the rest interface would actually

Re: Vibe.d rest & web service?

2018-02-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 19:50:31 UTC, Jacob Carlborg wrote: Have you tried this? No. But apart from the fact that I forgot to make the class inherit from an interface to that the rest interface would actually compile, the web interface is routed before the rest interface and so the

Re: Vibe.d rest & web service?

2018-02-07 Thread Jacob Carlborg via Digitalmars-d-learn
SomeData[] items; // Get void index() { render!("index.dt"); } // Get void getPage() { render!("page.dt", items); } // REST -> receive d as JSON. void postGiveMeData(SomeData d) { sync

Re: Vibe.d rest & web service?

2018-02-07 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 18:38:15 UTC, Seb wrote: How about using the normal Vibe.d Web Service? Stupid question: whats the difference? An example from my WIP project vibe-by-example project: https://github.com/wilzbach/vibe-d-by-example/blob/master/web/service.d I also have a for

Re: Vibe.d rest & web service?

2018-02-07 Thread Steven Schveighoffer via Digitalmars-d-learn
    SomeData[] items;     // Get     void index()     {     render!("index.dt");     }     // Get     void getPage()     {     render!("page.dt", items);     }     // REST -> receive d as JSON.     void postGiveMeData(SomeData d)     {     sync

Re: Vibe.d rest & web service?

2018-02-07 Thread Seb via Digitalmars-d-learn
} class MyInterface { SomeData[] items; // Get void index() { render!("index.dt"); } // Get void getPage() { render!("page.dt", items); } // REST -> receive d as JSON. void postGiveMeData(SomeData d) { sy

Re: Vibe.d rest & web service?

2018-02-07 Thread Nicholas Wilson via Digitalmars-d-learn
doesn't provide a way to distinguish between REST and not. I'm also not sure it is necessary, you can certainly have multiple class which provide REST and Web endpoints. You can even dynamically build routes within a route. Hmm, this might be one of the few use cases for nested classe

Re: Vibe.d rest & web service?

2018-02-07 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 17:04:13 UTC, Nicholas Wilson wrote: Is it possible to have some urls routed to serve content and some to receive JSON in the same class? This seems unlikely to me, the function signature doesn't provide a way to distinguish between REST and not. I&#

Vibe.d rest & web service?

2018-02-07 Thread Nicholas Wilson via Digitalmars-d-learn
{ render!("index.dt"); } // Get void getPage() { render!("page.dt", items); } // REST -> receive d as JSON. void postGiveMeData(SomeData d) { synchronized { items ~= d; } } }

Re: VibeD - REST API and vibed.web.auth framework

2017-08-07 Thread holo via Digitalmars-d-learn
Thank you for explanation. It fix my problem with compilation. I was using https://github.com/rejectedsoftware/vibe.d/blob/master/examples/web-auth/source/app.d as example and there is @safe function. I try to compile it with newest (beta) version of vibe.d and it compiled too (so i suspect in n

Re: VibeD - REST API and vibed.web.auth framework

2017-08-07 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 6 August 2017 at 16:47:14 UTC, holo wrote: Hello I'm trying to use auth framework with REST api ( http://vibed.org/api/vibe.web.auth/ ). Is it possible to use it with registerRestInterface? According to description under: http://vibed.org/api/vibe.web.auth/requiresAuth it s

VibeD - REST API and vibed.web.auth framework

2017-08-06 Thread holo via Digitalmars-d-learn
Hello I'm trying to use auth framework with REST api ( http://vibed.org/api/vibe.web.auth/ ). Is it possible to use it with registerRestInterface? According to description under: http://vibed.org/api/vibe.web.auth/requiresAuth it should be available on both Web and REST. Here

Re: Best way for handle missing args in REST interface in vibed

2017-05-30 Thread Suliman via Digitalmars-d-learn
I had post question here http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/43511/

Re: Best way for handle missing args in REST interface in vibed

2017-05-29 Thread Suliman via Digitalmars-d-learn
@rootPathFromName interface API { @path("mytrack") @method(HTTPMethod.GET)Json doTrackSpeedAnalyze(int trackid, string startDateTime, string endDateTime); } class MyRouter : API { Config config; Database database; this(Config config, Database database) { this.

Re: Best way for handle missing args in REST interface in vibed

2017-05-29 Thread Suliman via Digitalmars-d-learn
I wrote next code: void foo(string _error = null) { writeln("Error"); } override: @errorDisplay!foo Json doTrackSpeedAnalyze(int trackid, string startDateTime, string endDateTime) // /api/mytrack?trackid=123&startDateTime=2000&endDateTime=

Re: Best way for handle missing args in REST interface in vibed

2017-05-29 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 29 May 2017 at 12:23:59 UTC, Suliman wrote: I am doing REST interface with vibed. And thinking about handling errors, if users forgot to pass all expected args in function. For example: foo(int x, int y) // get request { } /api/foo?x=111 And if user is forgot to pass `y` we will

Re: Best way for handle missing args in REST interface in vibed

2017-05-29 Thread Suliman via Digitalmars-d-learn
On Monday, 29 May 2017 at 12:23:59 UTC, Suliman wrote: I am doing REST interface with vibed. And thinking about handling errors, if users forgot to pass all expected args in function. For example: foo(int x, int y) // get request { } /api/foo?x=111 And if user is forgot to pass `y` we will

Best way for handle missing args in REST interface in vibed

2017-05-29 Thread Suliman via Digitalmars-d-learn
I am doing REST interface with vibed. And thinking about handling errors, if users forgot to pass all expected args in function. For example: foo(int x, int y) // get request { } /api/foo?x=111 And if user is forgot to pass `y` we will get error in the browser. What is the right way to

Re: [vibe.d] How to create authentication system via REST interface?

2017-03-15 Thread Ali Çehreli via Digitalmars-d-learn
On 03/15/2017 07:06 AM, Suliman wrote: > You need to look at JWT. WekaIO uses jwtd, with minor improvements on it (improved error handling and code coverage): https://github.com/weka-io/jwtd Ali

Re: [vibe.d] How to create authentication system via REST interface?

2017-03-15 Thread aberba via Digitalmars-d-learn
On Wednesday, 15 March 2017 at 13:24:07 UTC, NX wrote: I'm trying to understand how to create some json-rest api that would return data (in json format) related to that specific logged in user. I see the documentation covers these but I'm totally new to vibe.d so can't quite fig

Re: [vibe.d] How to create authentication system via REST interface?

2017-03-15 Thread Suliman via Digitalmars-d-learn
On Wednesday, 15 March 2017 at 13:24:07 UTC, NX wrote: I'm trying to understand how to create some json-rest api that would return data (in json format) related to that specific logged in user. I see the documentation covers these but I'm totally new to vibe.d so can't quite fig

[vibe.d] How to create authentication system via REST interface?

2017-03-15 Thread NX via Digitalmars-d-learn
I'm trying to understand how to create some json-rest api that would return data (in json format) related to that specific logged in user. I see the documentation covers these but I'm totally new to vibe.d so can't quite figure out putting these two things together and make

Dangular - D Rest server + Angular frontend

2015-07-19 Thread via Digitalmars-d-learn
Hi I have created a personal project that aims to learn myself more about D/vibe.d and to create a simple and easy to grasp example on Mongo -> Vibe -> Angular. I have been thinking about the possibility of embedding D code in diet templates, as for ex to set api urls. Right now the urls are

Re: Dangular - D Rest server + Angular frontend

2015-07-19 Thread Etienne Cimon via Digitalmars-d-learn
On Sunday, 19 July 2015 at 19:54:31 UTC, Jarl André Hübenthal wrote: Hi I have created a personal project that aims to learn myself more about D/vibe.d and to create a simple and easy to grasp example on Mongo -> Vibe -> Angular. Nice ! I'm also working on a project like this, using some pai

Re: Dangular - D Rest server + Angular frontend

2015-07-19 Thread David DeWitt via Digitalmars-d-learn
On Sunday, 19 July 2015 at 19:54:31 UTC, Jarl André Hübenthal wrote: Hi I have created a personal project that aims to learn myself more about D/vibe.d and to create a simple and easy to grasp example on Mongo -> Vibe -> Angular. [...] Nice. I was thinking about doing one up in React but h

Re: Rest

2013-12-04 Thread guest
On Wednesday, 4 December 2013 at 09:09:56 UTC, qznc wrote: On Sunday, 1 December 2013 at 18:37:25 UTC, guest wrote: just wanted to know if something in my code is really bad or could be solved in more elegant way. Basicly things which people with more experience in D see on their first view of

Re: Rest

2013-12-04 Thread qznc
On Sunday, 1 December 2013 at 18:37:25 UTC, guest wrote: just wanted to know if something in my code is really bad or could be solved in more elegant way. Basicly things which people with more experience in D see on their first view of my code. The line splitting in HttpRequest can be simplif

Re: Rest

2013-12-01 Thread guest
just wanted to know if something in my code is really bad or could be solved in more elegant way. Basicly things which people with more experience in D see on their first view of my code.

Re: Rest

2013-12-01 Thread Dicebot
On Sunday, 1 December 2013 at 18:24:58 UTC, guest wrote: yes i have seen it. But i wanted to try it out my self. And thought it's a good project to learn D. Well, you need to be a bit more precise about kind of feedback you want to get than :) It is pretty large topic to talk about.

Re: Rest

2013-12-01 Thread Dicebot
Have you seen vibe.d REST module? It does exactly that - abuses D reflection for REStful HTTP API generation. code - https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/http/rest.d example - https://github.com/rejectedsoftware/vibe.d/blob/master/examples/rest/source/app.d

Re: Rest

2013-12-01 Thread guest
yes i have seen it. But i wanted to try it out my self. And thought it's a good project to learn D.

Rest

2013-12-01 Thread guest
Hi, i just got some progress in my first D project and wanted to know if i made some basic mistakes and what could have been done in an more elegant way. I'm open for every advice i get. The project is basicly a copy of javas jax-rs but in a very very early state :). I know my Httprequest an