paulvanbladel / aurelia-auth-sample

Sample for aurelia-auth
40 stars 20 forks source link

Typescript? #22

Closed mikecann closed 8 years ago

mikecann commented 8 years ago

This is excellent work, exactly what I needed to help me get going.

I was wondering if you or anyone has had a go at converting it to typescript? If not I may have a go.

paulvanbladel commented 8 years ago

Sure. Both client and server?

mikecann commented 8 years ago

Ye both client and server. I noticed there are some differences from the typescript skellington project too im assuming they arent important?

paulvanbladel commented 8 years ago

I think a separate branch with a type script version would be the best. Obviously readme needs to mention clear ly.

mikecann commented 8 years ago

What is the purpose of the proxy lines in serve.js ?

var proxyOptionsApiRoute = url.parse('http://localhost:' + paths.nodeJsPort + '/api') ; proxyOptionsApiRoute.route = '/api';

var proxyOptionsAuthRoute = url.parse('http://localhost:' + paths.nodeJsPort + '/auth') ; proxyOptionsAuthRoute.route = '/auth';

mikecann commented 8 years ago

Also could you explain the funky stuff going on on nav-bar.js? This differs from https://github.com/aurelia/skeleton-navigation/tree/master/skeleton-typescript/src

paulvanbladel commented 8 years ago

Hi, The proxy lines are there because I make a strict distinction between:

  1. static serving of files
  2. an application (in casu: nodeJs) for the rest api So, in the development environment i use BrowserSync for serving the static files, which happens on port 4000. The NodeJs app on the other hand runs on port 5000. So, all calls to paths starting with /api or /auth are forwarded to the nodeJs app, all the rest is served "statically". In production, I would do exactly the same and use NgInx for serving the static files and make the same kind of proxy setting for the rest api.

Make sense? cheers paul.

paulvanbladel commented 8 years ago

Regarding nav-bar.js. Well, maybe in more recent versions of aurelia, it might be that there is now a more elegant approach possible , but basically I want to observe the isAuthenticated property and update the displayName accordingly.

mikecann commented 8 years ago

Okay great thanks!

paulvanbladel commented 8 years ago

Hi Mike, Could you elaborate the typescript version ? cheers paul.

mikecann commented 8 years ago

Elaborate?

I decided in the end to do with a ASP Core based API in the end instead of a node one, so I abandoned my half-started TS port.