diff --git a/docs/docs/project/hosting.md b/docs/docs/project/hosting.md index f749f60e..8d6fce24 100644 --- a/docs/docs/project/hosting.md +++ b/docs/docs/project/hosting.md @@ -116,3 +116,45 @@ npx s hosting delete ``` !> After that your Hosting will be deleted from the configuration but folder with files will still be available in your local directory. Hosting will be removed from your backend during the next `npx s deploy`. + + +## Socket mapping + +Mapping is a configuration of hosting which gives you a possibility to expose Sockets endpoints as a part of the hosting URL. It is also helping to avoid preflighted requests in CORS. + +``` yaml + sockets_mapping: + - + - // + - / +``` + +For simple description how Socket mapping works let's assume that we have books-library socket with 3 endpoints + +``` yaml +# syncano/books-library/syncano.yaml + endpoints: + get-book: + description: get specific book + get-author-books: + description: get all author books + add-new-book: + description: add new book to database +``` + +``` yaml +# syncano.yaml +hosting: + website: + config: + sockets_mapping: + - + - /books-library/get-book + - books-library/get-book + - + - /books-library/get-author-books + - books-library/get-author-books + - + - /books-library/add-new-book + - books-library/add-new-book +```