Skip to content

Instantly share code, notes, and snippets.

@dasmido
Created January 19, 2018 20:50
Show Gist options
  • Save dasmido/a80da32a43b30cb069724c61720db876 to your computer and use it in GitHub Desktop.
Save dasmido/a80da32a43b30cb069724c61720db876 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import {Http, Headers} from '@angular/http';
import 'rxjs/add/operator/map';
@Injectable()
export class AuthService {
authToken: any;
user: any;
constructor(private http: Http) { }
// function to register user
registerUser(user){
let headers = new Headers();
headers.append('Content-Type', 'application/json');
return this.http.post('http://localhost:9090/users/register', user, {headers: headers}).map(res => res.json());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment