Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
xpub-faraday
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
xpub
xpub-faraday
Commits
bf229d0c
Commit
bf229d0c
authored
7 years ago
by
Sebastian
Browse files
Options
Downloads
Patches
Plain Diff
added proper readme
parent
039213ab
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/xpub-aws/README.md
+85
-2
85 additions, 2 deletions
packages/xpub-aws/README.md
with
85 additions
and
2 deletions
packages/xpub-aws/README.md
+
85
−
2
View file @
bf229d0c
## xPub-aws
# AWS S3 File Upload
In order to use
`xpub-aws`
you first need to have a
`.env`
file containing AWS data in the root folder of the starting point of your applications.
The
`.env`
file should look like this:
```
bash
AWS_ACCESS_KEY
=
exampleKey
AWS_SECRET_KEY
=
exampleKey/sads/21
AWS_REGION
=
region-name
AWS_BUCKET
=
bucket-name
```
Then, as soon as possible in your app you should add the
`dotenv`
package:
```
js
require
(
'
dotenv
'
).
config
()
```
# `xpub-aws` API
A list of endpoints that help you upload, download and delete S3 files.
\
## Upload a file [POST]
#### Request
`POST /api/aws-upload`
#### Request body
```
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryWfPNVh4wuWBlyEyQ
------WebKitFormBoundaryWfPNVh4wuWBlyEyQ
Content-Disposition: form-data; name="fileType"
supplementary
------WebKitFormBoundaryWfPNVh4wuWBlyEyQ
Content-Disposition: form-data; name="fragmentId"
545
------WebKitFormBoundaryWfPNVh4wuWBlyEyQ
Content-Disposition: form-data; name="file"; filename="attachment.txt"
Content-Type: text/plain
[file content goes there]
------WebKitFormBoundaryWfPNVh4wuWBlyEyQ
```
#### Response
```
json
{
"id"
:
"unique-file-id"
,
"name"
:
"Document Name.doc"
,
"size"
:
452097
}
```
---
## Retrieve file signed URL [GET]
This endpoint allows you to retrieve a file's signed URL that can be used to download the file.
#### Request
`
GET /api/aws-signed-url/{fragmentId}/{fileId}`
|
URI
Parameter|Requiered|Requirements|Description|
|
:---: | :---: | :---: | :---: |
|
fragmentId | Yes | String | The ID of the fragment to which the file belongs to |
|
fileId | Yes | String | The ID of the file |
#
### Response
`
``json
H
TTP/1.1 200
{
"signedUrl": "aws-url"
}
`
``
-
--
## Delete file [DELETE]
#### Request
`DELETE /api/aws-delete/{fragmentId}/{fileId}`
|URI Parameter|Requiered|Requirements|Description|
| :---: | :---: | :---: | :---: |
| fragmentId | Yes | String | The ID of the fragment to which the file belongs to |
| fileId | Yes | String | The ID of the file |
#### Response
```
json
HTTP/
1.1
204
```
---
A server package that handles AWS
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment