src/main/java/com/example/heroku/Main.java
public static HttpServer startRestServer(int port) {
		try {
			restServerURI = UriBuilder.fromUri("http://" + InetAddress.getLocalHost().getHostAddress() + "/").port(port)
					.build();

			ResourceConfig rc = new ResourceConfig();
			rc.registerClasses(MyResource.class);

			HttpServer s = GrizzlyHttpServerFactory.createHttpServer(restServerURI, rc);
			System.out.println("Rest API is running on " + restServerURI + "\n");
			return s;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
/**
	 * Start a server in a given port (port read from .env file)
	 * 
	 * @param port where server will run (by default 8080)
	 * @return an http server
	 */
Start a server in a given port (port read from .env file)

@param port where server will run (by default 8080)
@return an http server
Start a server in a given port ( port read from . env file ) @param port where server will run ( by default 8080 ) @return an http server
public static HttpServer startRestServer(int port) {
		try {
			restServerURI = UriBuilder.fromUri("http://" + InetAddress.getLocalHost().getHostAddress() + "/").port(port)
					.build();
			ResourceConfig rc = new ResourceConfig();
			rc.registerClasses(MyResource.class);
			HttpServer s = GrizzlyHttpServerFactory.createHttpServer(restServerURI, rc);
			System.out.println("Rest API is running on " + restServerURI + "\n");
			return s;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
public static HttpServer startRestServer ( int port ) { try { restServerURI = UriBuilder . fromUri ( "http://" + InetAddress . getLocalHost ( ) . getHostAddress ( ) + "/" ) . port ( port ) . build ( ) ; ResourceConfig rc = new ResourceConfig ( ) ; rc . registerClasses ( MyResource . class ) ; HttpServer s = GrizzlyHttpServerFactory . createHttpServer ( restServerURI , rc ) ; System . out . println ( "Rest API is running on " + restServerURI + "\n" ) ; return s ; } catch ( Exception e ) { e . printStackTrace ( ) ; return null ; } }
Start a server in a given port (port read from .env file)
Start a server in a given port ( port read from . env file )