Commit aea8a59c authored by Mathias Jud's avatar Mathias Jud Committed by Katharina Fey

http-api: changed url prefix '/rest' to '/http'

parent 824013f1
Pipeline #1132 failed with stages
in 5 minutes and 46 seconds
......@@ -54,7 +54,7 @@ impl HttpServer {
let http_state = rpc_state.clone();
// REST Endpoint
app.at("/rest")
app.at("/http")
.strip_prefix()
.nest(http::routes::http_routes(http_state));
......
#!/usr/bin/env bash
set -ex
# Create users
source src/users-bootstrap.sh
# Create a chat-room for user A
source src/chat-rooms-create.sh "$B_ID" "$A_ID" $A_TOKEN
......@@ -5,7 +5,7 @@
# usage:
# ./chat-messages-create.sh <ROOM_ID> <USER_ID> <USER_TOKEN>
http POST 127.0.0.1:9900/rest/chat-messages \
http POST 127.0.0.1:9900/http/chat-messages \
room="$1" \
text="hello world!" \
"Authorization:{\"id\":\"$2\",\"token\":\"$3\"}"
......@@ -5,5 +5,5 @@
# usage:
# ./chat-messages-query.sh <ROOM_ID> <USER_ID> <USER_TOKEN>
http GET 127.0.0.1:9901/rest/chat-messages?chat-room=$1 \
http GET 127.0.0.1:9901/http/chat-messages?chat-room=$1 \
"Authorization:{\"id\":\"$2\",\"token\":\"$3\"}"
......@@ -5,7 +5,7 @@
# usage:
# ./chat-rooms_create.sh <FRIEND_ID> <USER_ID> <USER_TOKEN>
RETURN=$(http POST 127.0.0.1:9900/rest/chat-rooms \
RETURN=$(http POST 127.0.0.1:9900/http/chat-rooms \
users:="[\"$1\"]" \
name="Test Name" \
"Authorization:{\"id\":\"$2\",\"token\":\"$3\"}" 2>/dev/null | tail -n 1)
......
......@@ -7,5 +7,5 @@
TRIMMED_ID=$(echo $1 | tr -d ' ')
http DELETE 127.0.0.1:9900/rest/chat/rooms/$TRIMMED_ID \
http DELETE 127.0.0.1:9900/http/chat/rooms/$TRIMMED_ID \
"Authorization:{\"id\":\"$2\",\"token\":\"$3\"}"
......@@ -7,5 +7,5 @@
TRIMMED_ID=$(echo $1 | tr -d ' ')
http 127.0.0.1:9900/rest/chat-rooms/$TRIMMED_ID \
http 127.0.0.1:9900/http/chat-rooms/$TRIMMED_ID \
"Authorization:{\"id\":\"$2\",\"token\":\"$3\"}"
......@@ -5,5 +5,5 @@
# usage:
# ./chat-rooms-list.sh <USER_ID> <USER_TOKEN>
http 127.0.0.1:9900/rest/chat-rooms \
http 127.0.0.1:9900/http/chat-rooms \
"Authorization:{\"id\":\"$1\",\"token\":\"$2\"}"
......@@ -7,5 +7,5 @@
TRIMMED_ID=$(echo $1 | tr -d ' ')
http 127.0.0.1:9900/rest/chat-rooms/$TRIMMED_ID \
http 127.0.0.1:9900/http/chat-rooms/$TRIMMED_ID \
"Authorization:{\"id\":\"$2\",\"token\":\"$3\"}"
......@@ -5,5 +5,5 @@
# usage:
# ./contacts-list.sh <USER_ID> <USER_TOKEN>
http 127.0.0.1:9900/rest/contacts \
http 127.0.0.1:9900/http/contacts \
"Authorization:{\"id\":\"$1\",\"token\":\"$2\"}"
......@@ -5,6 +5,6 @@
# usage:
# ./login.sh <USER_ID>
http POST 127.0.0.1:9900/rest/login \
http POST 127.0.0.1:9900/http/login \
id="$1" \
pw=123456
......@@ -6,5 +6,5 @@
# ./logout.sh <USER_ID> <USER_TOKEN>
#
http GET 127.0.0.1:9900/rest/logout \
http POST 127.0.0.1:9900/http/logout \
"Authorization:{\"id\":\"$1\",\"token\":\"$2\"}"
......@@ -5,5 +5,5 @@
# usage:
# ./users-create.sh
http POST 127.0.0.1:9901/rest/users \
http POST 127.0.0.1:9901/http/users \
pw=123456
......@@ -5,5 +5,5 @@
# usage:
# ./users-create.sh
http POST 127.0.0.1:9900/rest/users \
http POST 127.0.0.1:9900/http/users \
pw=123456
......@@ -7,6 +7,6 @@
TRIMMED_ID=$(echo $1 | tr -d ' ')
http DELETE 127.0.0.1:9900/rest/users/$TRIMMED_ID \
http DELETE 127.0.0.1:9900/http/users/$TRIMMED_ID \
purge:=true \
"Authorization:{\"id\":\"$1\",\"token\":\"$2\"}"
......@@ -8,5 +8,5 @@
TRIMMED_ID=$(echo $1 | tr -d ' ')
http GET 127.0.0.1:9900/rest/users/$TRIMMED_ID \
http GET 127.0.0.1:9900/http/users/$TRIMMED_ID \
"Authorization:{\"id\":\"$1\",\"token\":\"$2\"}"
......@@ -5,4 +5,4 @@
# usage:
# ./users-list.sh
http 127.0.0.1:9900/rest/users
\ No newline at end of file
http 127.0.0.1:9900/http/users
\ No newline at end of file
......@@ -8,7 +8,7 @@
TRIMMED_ID=$(echo $1 | tr -d ' ')
http PATCH 127.0.0.1:9900/rest/users/$TRIMMED_ID \
http PATCH 127.0.0.1:9900/http/users/$TRIMMED_ID \
display_name=testuser \
real_name="" \
"Authorization:{\"id\":\"$1\",\"token\":\"$2\"}"
......@@ -8,7 +8,7 @@
TRIMMED_ID=$(echo $1 | tr -d ' ')
http PATCH 127.0.0.1:9900/rest/users/$TRIMMED_ID \
http PATCH 127.0.0.1:9900/http/users/$TRIMMED_ID \
display_name=testuser \
real_name="My Real Name" \
"Authorization:{\"id\":\"$1\",\"token\":\"$2\"}"
......@@ -16,7 +16,7 @@ function serializeIntoHash(store, modelClass, snapshot, options = { includeId: t
}
export default class ApplicationAdapter extends RESTAdapter {
namespace = 'rest';
namespace = 'http';
@service() session;
......
......@@ -2,11 +2,11 @@ import ApplicationAdapter from './application';
export default class ChatMessageAdapter extends ApplicationAdapter {
urlForQuery(query) {
const path = `/rest/chat-messages/${query.room}`;
const path = `/http/chat-messages/${query.room}`;
delete query.room;
return path;
}
urlForCreateRecord(modelName, snapshot) {
return `/rest/chat-messages/${snapshot.belongsTo('room').id.replace(/-/g, '')}`
return `/http/chat-messages/${snapshot.belongsTo('room').id.replace(/-/g, '')}`
}
}
......@@ -3,7 +3,7 @@ import ApplicationAdapter from './application';
export default class UserAdapter extends ApplicationAdapter {
urlForQuery(query) {
return {
contact: () => '/rest/contacts',
contact: () => '/http/contacts',
}[query.type]();
}
}
......@@ -2,7 +2,7 @@ import Base from 'ember-simple-auth/authenticators/base';
export default class QaulAuthenticator extends Base {
async restore(data) {
const validateTokenResponse = await fetch('/rest/validate_token', {
const validateTokenResponse = await fetch('/http/validate_token', {
headers: {
Authorization: JSON.stringify(data),
}
......@@ -15,7 +15,7 @@ export default class QaulAuthenticator extends Base {
}
async authenticate(id, pw) {
const loginResponse = await fetch('/rest/login', {
const loginResponse = await fetch('/http/login', {
method: 'POST',
body: JSON.stringify({ id, pw }),
});
......@@ -27,7 +27,7 @@ export default class QaulAuthenticator extends Base {
}
async invalidate({ id, token }) {
await fetch(`/rest/logout`, {
await fetch(`/http/logout`, {
method: 'POST',
headers: {
Authorization: JSON.stringify({ id, token }),
......
......@@ -14,7 +14,7 @@ export default class RegisterController extends Controller {
async register(event) {
event.preventDefault();
const createUserResponse = await fetch('/rest/users', {
const createUserResponse = await fetch('/http/users', {
method: 'POST',
body: JSON.stringify({
pw: this.password,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment