Add /api to all application server endpoints
This commit is contained in:
parent
e6613f3ec0
commit
6045088d72
@ -42,7 +42,7 @@ client.BaseAddress = new System.Uri(OPENVIDU_URL);
|
||||
var basicAuth = Convert.ToBase64String(System.Text.ASCIIEncoding.UTF8.GetBytes($"OPENVIDUAPP:{OPENVIDU_SECRET}"));
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", basicAuth);
|
||||
|
||||
app.MapPost("/sessions", async (HttpRequest request) =>
|
||||
app.MapPost("/api/sessions", async (HttpRequest request) =>
|
||||
{
|
||||
String contentString;
|
||||
HttpContent content;
|
||||
@ -62,7 +62,7 @@ app.MapPost("/sessions", async (HttpRequest request) =>
|
||||
return sessionId;
|
||||
});
|
||||
|
||||
app.MapPost("/sessions/{sessionId}/connections", async (HttpRequest request, [FromRoute] string sessionId) =>
|
||||
app.MapPost("/api/sessions/{sessionId}/connections", async (HttpRequest request, [FromRoute] string sessionId) =>
|
||||
{
|
||||
HttpContent content;
|
||||
using (var streamContent = new StreamContent(request.Body)) {
|
||||
|
||||
@ -42,7 +42,7 @@ public class Controller {
|
||||
* @param params The Session properties
|
||||
* @return The Session ID
|
||||
*/
|
||||
@PostMapping("/sessions")
|
||||
@PostMapping("/api/sessions")
|
||||
public ResponseEntity<String> initializeSession(@RequestBody(required = false) Map<String, Object> params)
|
||||
throws OpenViduJavaClientException, OpenViduHttpException {
|
||||
SessionProperties properties = SessionProperties.fromJson(params).build();
|
||||
@ -55,7 +55,7 @@ public class Controller {
|
||||
* @param params The Connection properties
|
||||
* @return The Token associated to the Connection
|
||||
*/
|
||||
@PostMapping("/sessions/{sessionId}/connections")
|
||||
@PostMapping("/api/sessions/{sessionId}/connections")
|
||||
public ResponseEntity<String> createConnection(@PathVariable("sessionId") String sessionId,
|
||||
@RequestBody(required = false) Map<String, Object> params)
|
||||
throws OpenViduJavaClientException, OpenViduHttpException {
|
||||
|
||||
@ -30,12 +30,12 @@ var openvidu = new OpenVidu(
|
||||
process.env.OPENVIDU_SECRET
|
||||
);
|
||||
|
||||
app.post("/sessions", async (req, res) => {
|
||||
app.post("/api/sessions", async (req, res) => {
|
||||
var session = await openvidu.createSession(req.body);
|
||||
res.send(session.sessionId);
|
||||
});
|
||||
|
||||
app.post("/sessions/:sessionId/connections", async (req, res) => {
|
||||
app.post("/api/sessions/:sessionId/connections", async (req, res) => {
|
||||
var session = openvidu.activeSessions.find(
|
||||
(s) => s.sessionId === req.params.sessionId
|
||||
);
|
||||
|
||||
@ -13,7 +13,7 @@ OPENVIDU_URL = os.environ.get("OPENVIDU_URL")
|
||||
OPENVIDU_SECRET = os.environ.get("OPENVIDU_SECRET")
|
||||
|
||||
|
||||
@app.route("/sessions", methods=['POST'])
|
||||
@app.route("/api/sessions", methods=['POST'])
|
||||
def initializeSession():
|
||||
try:
|
||||
body = request.json if request.data else {}
|
||||
@ -34,7 +34,7 @@ def initializeSession():
|
||||
return err
|
||||
|
||||
|
||||
@app.route("/sessions/<sessionId>/connections", methods=['POST'])
|
||||
@app.route("/api/sessions/<sessionId>/connections", methods=['POST'])
|
||||
def createConnection(sessionId):
|
||||
body = request.json if request.data else {}
|
||||
return requests.post(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user