package com.raillearn;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class TripController {

    @Autowired
    TripRepository tripRepository;

    @RequestMapping(value = "/trips", method = RequestMethod.GET)
    public List<Trip> getTrips() {
        return tripRepository.findAll();
    }

    @RequestMapping(value = "/trips", method = RequestMethod.POST)
    public Trip postTrip(@RequestBody Trip trip) {
        return tripRepository.save(trip);
    }

    @RequestMapping(value = "/trips/{id}/join", method = RequestMethod.POST)
    public Trip postTrip(@PathVariable long id) {
        return tripRepository.findOne(id);
    }
}

package com.raillearn;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class TripController {

    @Autowired
    TripRepository tripRepository;

    @RequestMapping(value = "/trips", method = RequestMethod.GET)
    public List<Trip> getTrips() {
        return tripRepository.findAll();
    }

    @RequestMapping(value = "/trips", method = RequestMethod.POST)
    public Trip postTrip(@RequestBody Trip trip) {
        return tripRepository.save(trip);
    }

    @RequestMapping(value = "/trips/{id}/join", method = RequestMethod.POST)
    public Trip postTrip(@PathVariable long id) {
        return tripRepository.findOne(id);
    }

    @RequestMapping(value = "/user/login", method = RequestMethod.POST)
    public String logInUser(@RequestParam String token) {
        return token;
    }
}

Add log in user receive.
Add log in user receive.
