You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Paul Hammant <pa...@hammant.org> on 2016/02/20 18:06:44 UTC

CouchDB, CORS and Angular+SVG app (hosted on Github Pages)

I think it qualifies as "serverless", but not as a CouchApp (if it does I
will head off to that mail list instead of this one)

A HTML+SVG app speaks to Couch via CORS, and is otherwise hosted on
GithubPages. Someone might be interested:

    http://paulhammant.com/2015/12/21/angular-and-svg-and-couchdb/

Next up, allow the seat information without authentication, but log in to
Couch, if a change is wanted.  I think that's possible with Couch, but I
have a grand total of six hours experience with it.  Thoughts?

- Paul

Re: CouchDB, CORS and Angular+SVG app (hosted on Github Pages)

Posted by Sebastian Rothbucher <se...@googlemail.com>.
Hi Paul,

I'm afraid you have to use curl for the _users DB ;-) - but this is rather
straightforward:
https://wiki.apache.org/couchdb/How_to_create_users_via_script

Best
     Sebastian

On Sun, Feb 21, 2016 at 5:56 PM, Paul Hammant <pa...@hammant.org> wrote:

> Great tip - Sebastian - I'm 100% sure I can do the Angular side of it now.
>
> Related problem. I'm struggling to make the smallest amount of CURL
> statements to close-down admin-party, and have the 'seats' repo:
>
> 1) anon is approved for *read* operations
> 2) must authenticate for *write* operations
>
> Of course - I'd be happy to do the same with Perl one-liners on
> default.ini, but users (etc) are not held in there.
>
> - Paul
>
>
> On Sun, Feb 21, 2016 at 9:39 AM, Sebastian Rothbucher <
> sebastianrothbucher@googlemail.com> wrote:
>
> > Hi Paul,
> >
> > this looks great! Basically, you can submit credentials with the HTTP
> > request and even keep cookies between requests from another server. So
> yes,
> > logging in via POST and keeping the cookie could work when turning on
> this
> > behavior in angular (which passes down to XHR):
> > mymodule.config(function ($httpProvider)
> > {$httpProvider.defaults.withCredentials=true;});
> >
> > I did try this against Tomcat on another occasion (so Tomcat port 1,
> > http-server with angular port 2) and it did work - there, it was a POST
> to
> > login (like in Couch: there it's a POST to _session) and with above
> > setting, the login gets submitted with each further request
> >
> > Hope this works / helps - let us know!
> >
> > Best
> >     Sebastian
> >
> >
> > On Sat, Feb 20, 2016 at 6:06 PM, Paul Hammant <pa...@hammant.org> wrote:
> >
> > > I think it qualifies as "serverless", but not as a CouchApp (if it
> does I
> > > will head off to that mail list instead of this one)
> > >
> > > A HTML+SVG app speaks to Couch via CORS, and is otherwise hosted on
> > > GithubPages. Someone might be interested:
> > >
> > >     http://paulhammant.com/2015/12/21/angular-and-svg-and-couchdb/
> > >
> > > Next up, allow the seat information without authentication, but log in
> to
> > > Couch, if a change is wanted.  I think that's possible with Couch, but
> I
> > > have a grand total of six hours experience with it.  Thoughts?
> > >
> > > - Paul
> > >
> >
>

Re: CouchDB, CORS and Angular+SVG app (hosted on Github Pages)

Posted by Paul Hammant <pa...@hammant.org>.
Great tip - Sebastian - I'm 100% sure I can do the Angular side of it now.

Related problem. I'm struggling to make the smallest amount of CURL
statements to close-down admin-party, and have the 'seats' repo:

1) anon is approved for *read* operations
2) must authenticate for *write* operations

Of course - I'd be happy to do the same with Perl one-liners on
default.ini, but users (etc) are not held in there.

- Paul


On Sun, Feb 21, 2016 at 9:39 AM, Sebastian Rothbucher <
sebastianrothbucher@googlemail.com> wrote:

> Hi Paul,
>
> this looks great! Basically, you can submit credentials with the HTTP
> request and even keep cookies between requests from another server. So yes,
> logging in via POST and keeping the cookie could work when turning on this
> behavior in angular (which passes down to XHR):
> mymodule.config(function ($httpProvider)
> {$httpProvider.defaults.withCredentials=true;});
>
> I did try this against Tomcat on another occasion (so Tomcat port 1,
> http-server with angular port 2) and it did work - there, it was a POST to
> login (like in Couch: there it's a POST to _session) and with above
> setting, the login gets submitted with each further request
>
> Hope this works / helps - let us know!
>
> Best
>     Sebastian
>
>
> On Sat, Feb 20, 2016 at 6:06 PM, Paul Hammant <pa...@hammant.org> wrote:
>
> > I think it qualifies as "serverless", but not as a CouchApp (if it does I
> > will head off to that mail list instead of this one)
> >
> > A HTML+SVG app speaks to Couch via CORS, and is otherwise hosted on
> > GithubPages. Someone might be interested:
> >
> >     http://paulhammant.com/2015/12/21/angular-and-svg-and-couchdb/
> >
> > Next up, allow the seat information without authentication, but log in to
> > Couch, if a change is wanted.  I think that's possible with Couch, but I
> > have a grand total of six hours experience with it.  Thoughts?
> >
> > - Paul
> >
>

Re: CouchDB, CORS and Angular+SVG app (hosted on Github Pages)

Posted by Sebastian Rothbucher <se...@googlemail.com>.
Hi Paul,

this looks great! Basically, you can submit credentials with the HTTP
request and even keep cookies between requests from another server. So yes,
logging in via POST and keeping the cookie could work when turning on this
behavior in angular (which passes down to XHR):
mymodule.config(function ($httpProvider)
{$httpProvider.defaults.withCredentials=true;});

I did try this against Tomcat on another occasion (so Tomcat port 1,
http-server with angular port 2) and it did work - there, it was a POST to
login (like in Couch: there it's a POST to _session) and with above
setting, the login gets submitted with each further request

Hope this works / helps - let us know!

Best
    Sebastian


On Sat, Feb 20, 2016 at 6:06 PM, Paul Hammant <pa...@hammant.org> wrote:

> I think it qualifies as "serverless", but not as a CouchApp (if it does I
> will head off to that mail list instead of this one)
>
> A HTML+SVG app speaks to Couch via CORS, and is otherwise hosted on
> GithubPages. Someone might be interested:
>
>     http://paulhammant.com/2015/12/21/angular-and-svg-and-couchdb/
>
> Next up, allow the seat information without authentication, but log in to
> Couch, if a change is wanted.  I think that's possible with Couch, but I
> have a grand total of six hours experience with it.  Thoughts?
>
> - Paul
>