Skip to content

Instantly share code, notes, and snippets.

View marco-mendes's full-sized avatar

Marco Mendes marco-mendes

View GitHub Profile
public static void main(String[] args) throws UnknownHostException {
SpringApplication app = new SpringApplication(AngularspringbootmicrosservicoApp.class);
DefaultProfileUtil.addDefaultProfile(app);
Environment env = app.run(args).getEnvironment();
String protocol = "http";
if (env.getProperty("server.ssl.key-store") != null) {
protocol = "https";
}
log.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
router.get('/', async (req, res) => {
const users = await User.find();
return res.send({ users });
});
router.post('/login', async (req, res, next) => {
const { name, password } = req.body;
try {
package hello;
import java.util.concurrent.atomic.AtomicLong;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GreetingController {
@Endpoint
public class CountryEndpoint {
private static final String NAMESPACE_URI = "http://spring.io/guides/gs-producing-web-service";
private CountryRepository countryRepository;
@Autowired
public CountryEndpoint(CountryRepository countryRepository) {
this.countryRepository = countryRepository;
}