Giter VIP home page Giter VIP logo

actix-web-rest-api-with-jwt's Introduction

Actix-web REST API with JWT

CI Docker CICD

A simple CRUD backend app using Actix-web, Diesel and JWT

Require

Or using Docker

P/s: On Linux distro maybe got error like "= note: /usr/bin/ld: cannot find -lsqlite3"

  • Fedora/CentOS
    • Step 1: Find lib by command yum list 'sqlite'
    • Step 2: Run command sudo dnf/yum install libsqlite3x.x86_64 libsqlite3x-devel.x86_64
  • Ubuntu/Ubuntu Server
    • Step 1: Run command sudo apt-get install libsqlite3-dev libpq-dev

How to run

Manual

  • Install postgresql and sqlite backend libraries, more details here
    • For Windows: Copy all files inside libs\windows folder to other location (e.g C:\libs). Add PQ_LIB_DIR and SQLITE3_LIB_DIR environment variable with value C:\libs. Then restart all terminal windows.
    • For Linux: Install libpq and libsqlite3 depends on your distribution.
    • For MacOS: Install libpq using homebrew: brew install libpq
  • Rename secret.key.sample to secret.key or create your own key by running head -c16 /dev/urandom > secret.key in command line (Linux/UNIX only) and copy to /src folder
  • Create a database in postgres cli or pgAdmin tool
  • Rename dotenv.sample to .env and update the database connection string in DATABASE_URL key.
  • Build with release profile: cargo build --release
  • Run release binary in command line/terminal.
    • Windows: target/release/actix-web-rest-api-with-jwt.exe
    • Linux/UNIX: target/release/actix-web-rest-api-with-jwt
  • Enjoy! ๐Ÿ˜„

Docker

  • Enter into project directory
  • Run docker-compose -f docker-compose.local.yml up for local environment or docker-compose -f docker-compose.prod.yml up for production environment
  • Enjoy! ๐Ÿ˜„

Note for yew-address-book-client

  • I also made yew-address-book-client, an Address Book Frontend using yew-rs.
  • yew-address-book-client is heavily under in development, currently the web client does not have login/signup page, so if you want to integrate with backend-side, comment this line bellow in main.rs to disable authentication middleware
    .wrap(crate::middleware::auth_middleware::Authentication)

APIs

Address: localhost:8000

GET /api/ping: Ping

curl -X GET -i 'http://127.0.0.1:8000/api/ping'
  • Response:
    • 200 OK

      pong!
      

POST /api/auth/signup: Signup

curl -X POST -i 'http://127.0.0.1:8000/api/auth/signup' \
  -H "Content-Type: application/json" \
  --data '{
    "username": "user",
    "email": "[email protected]",
    "password": "4S3cr3tPa55w0rd"
  }'
  • Request body:

    {
       "username": string,
       "email": string,
       "password": string       // a raw password
    }
    
  • Response

    • 200 OK
    {
       "message": "signup successfully",
       "data": ""
    }
    • 400 Bad Request
    {
       "message": "User '{username}' is already registered",
       "data": ""
    }

POST /api/auth/login: Login

curl -X POST -H 'Content-Type: application/json' -i 'http://127.0.0.1:8000/api/auth/login'  \
  --data '{"username_or_email":"user",  "password":"4S3cr3tPa55w0rd"}'
  • Request body:

    {
       "username_or_email": string,
       "password": string       // a raw password
    }
    
  • Response

    • 200 OK
    {
       "message": "login successfully",
       "data": {
         "token": string      // bearer token
       }
    }
    
    • 400 Bad Request
    {
       "message": "wrong username or password, please try again",
       "data": ""
    }

POST /api/auth/logout: Logout

curl -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NzcyNTc4NzksImV4cCI6MTU3Nzg2MjY3OSwidXNlciI6ImMiLCJsb2dpbl9zZXNzaW9uIjoiYzUxNWE3NTg3NGYzNGVjNGFmNDJmNWE2M2QxMDVjMGYifQ.B9w6FxFdypb5GCRMKXZ9CZWFxQLFjvmPSusMCtcE-Ac' \
  -i 'http://127.0.0.1:8000/api/auth/logout'

GET /api/address-book: Get all people information

curl -X GET -H 'Content-Type: application/json' \
  -H 'Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NzU4NzM4MjksImV4cCI6MTU3NjQ3ODYyOSwidXNlciI6ImMiLCJsb2dpbl9zZXNzaW9uIjoiZjU5N2M3MTIxZTExNDBhMGE0ZjE0YmQ4N2NjM2Q4MWUifQ.6qppDfRgOw45eExJ7MUEwpcu3AUXXe9_ifj_mp7k22k' \
  -i 'http://127.0.0.1:8000/api/address-book'
  • Header:

    • Authorization: bearer <token>
  • Response

    • 200 OK
    {
       "message": "ok",
       "data": [
          {
            "id": int32,
            "name": string,
            "gender": boolean,      // true for male, false for female
            "age": int32,
            "address": string,
            "phone": string,
            "email": string
          }
       ]
    }
    

GET /api/address-book/{id}: Get person information by id

curl -X GET -H 'Content-Type: application/json' \
  -H 'Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NzU4NzM4MjksImV4cCI6MTU3NjQ3ODYyOSwidXNlciI6ImMiLCJsb2dpbl9zZXNzaW9uIjoiZjU5N2M3MTIxZTExNDBhMGE0ZjE0YmQ4N2NjM2Q4MWUifQ.6qppDfRgOw45eExJ7MUEwpcu3AUXXe9_ifj_mp7k22k' \
  -i 'http://127.0.0.1:8000/api/address-book/2'
  • Param path:

    • id: int32
  • Header:

    • Authorization: bearer <token>
  • Response

    • 200 OK
    {
       "message": "ok",
       "data": {
         "id": int32,
         "name": string,
         "gender": boolean,      // true for male, false for female
         "age": int32,
         "address": string,
         "phone": string,
         "email": string
       }
    }
    
    • 404 Not Found
    {
       "message": "person with id {id} not found",
       "data": ""
    }

GET /api/address-book/filter: Filter person information

curl -X GET -H 'Content-Type: application/json' \
  -H 'Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NzU4NzM4MjksImV4cCI6MTU3NjQ3ODYyOSwidXNlciI6ImMiLCJsb2dpbl9zZXNzaW9uIjoiZjU5N2M3MTIxZTExNDBhMGE0ZjE0YmQ4N2NjM2Q4MWUifQ.6qppDfRgOw45eExJ7MUEwpcu3AUXXe9_ifj_mp7k22k' \
  -i 'http://127.0.0.1:8000/api/address-book/filter?name=foo&sort_by=name&sort_direction=asc&page_num=0&page_size=10'
  • Query param:

    • id: int32
    • name: string
    • gender: boolean
    • age: int32
    • address: String
    • phone: string
    • email: string
    • sort_by: string
    • sort_direction: string (ASC or DESC)
    • page_num: int32
    • page_size: int32
  • Header:

    • Authorization: bearer <token>
  • Response

    • 200 OK
    {
      "message": "ok",
      "data": [
        {
          "id": int32,
          "name": string,
          "gender": boolean,      // true for male, false for female
          "age": int32,
          "address": string,
          "phone": string,
          "email": string
        }
      ],
      "page_num": int32,
      "page_size": int32,
      "total_elements": int32
    }
    

POST /api/address-book: Add person information

curl -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NzU4NzM4MjksImV4cCI6MTU3NjQ3ODYyOSwidXNlciI6ImMiLCJsb2dpbl9zZXNzaW9uIjoiZjU5N2M3MTIxZTExNDBhMGE0ZjE0YmQ4N2NjM2Q4MWUifQ.6qppDfRgOw45eExJ7MUEwpcu3AUXXe9_ifj_mp7k22k' \
  -i 'http://127.0.0.1:8000/api/address-book' \
  --data '{
    "name": "c",
    "gender": true,
    "age": 32,
    "address": "addr",
    "phone": "133",
    "email": "[email protected]"
  }
'
  • Header:

    • Authorization: bearer <token>
  • Request body:

    {
      "name": string,
      "gender": boolean,      // true for male, false for female
      "age": int32,
      "address": string,
      "phone": string,
      "email": string
    }
    
  • Response

    • 201 Created
    {
      "message": "ok",
      "data": ""
    }
    • 500 Internal Server Error
    {
      "message": "can not insert data",
      "data": ""
    }

PUT /api/address-book/{id}: Update person information by id

curl -X PUT -H 'Content-Type: application/json' \
  -H 'Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NzU4NzM4MjksImV4cCI6MTU3NjQ3ODYyOSwidXNlciI6ImMiLCJsb2dpbl9zZXNzaW9uIjoiZjU5N2M3MTIxZTExNDBhMGE0ZjE0YmQ4N2NjM2Q4MWUifQ.6qppDfRgOw45eExJ7MUEwpcu3AUXXe9_ifj_mp7k22k' \
  -i 'http://127.0.0.1:8000/api/address-book/2' \
  --data '{
    "name": "b",
    "gender": true,
    "age": 32,
    "address": "addr",
    "phone": "133",
    "email": "[email protected]"
  }
'
  • Param path:

    • id: int32
  • Header:

    • Authorization: bearer <token>
  • Request body:

    {
      "name": string,
      "gender": boolean,      // true for male, false for female
      "age": int32,
      "address": string,
      "phone": string,
      "email": string
    }
    
  • Response

    • 200 OK
    {
      "message": "ok",
      "data": ""
    }
    • 500 Internal Server Error
    {
      "message": "can not update data",
      "data": ""
    }

DELETE /api/address-book/{id}: Delete person information by id

curl -X DELETE -H 'Content-Type: application/json' \
  -H 'Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NzU4NzM4MjksImV4cCI6MTU3NjQ3ODYyOSwidXNlciI6ImMiLCJsb2dpbl9zZXNzaW9uIjoiZjU5N2M3MTIxZTExNDBhMGE0ZjE0YmQ4N2NjM2Q4MWUifQ.6qppDfRgOw45eExJ7MUEwpcu3AUXXe9_ifj_mp7k22k' \
  -i 'http://127.0.0.1:8000/api/address-book/2'
  • Param path:

    • id: int32
  • Header:

    • Authorization: bearer <token>
  • Response

    • 200 OK
    {
      "message": "ok",
      "data": ""
    }
    • 500 Internal Server Error
    {
      "message": "can not delete data",
      "data": ""
    }

browser OPTIONS curl request example

curl -X OPTIONS -i 'http://127.0.0.1:8000/api/login' \
  -H "Origin: http://example.com" -H "Access-Control-Request-Method: POST"
  • Response

    HTTP/1.1 200 OK
    content-length: 0
    access-control-max-age: 3600
    access-control-allow-methods: POST,DELETE,GET,PUT
    access-control-allow-origin: *
    access-control-allow-headers: authorization,content-type,accept
    date: Tue, 07 Jan 2020 15:17:48 GMT
    

Errors

  • Invalid or missing token

    • Status code: 401 Unauthorized
    • Response:
    {
      "message": "invalid token, please login again",
      "data": ""
    }

actix-web-rest-api-with-jwt's People

Contributors

caitlingao avatar eruca avatar sakadream avatar thehaung avatar tntxtnt avatar wenewzhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

actix-web-rest-api-with-jwt's Issues

System is not running when cargo run

thread 'main' panicked at 'System is not running', /Users/nick/.cargo/registry/src/mirrors.ustc.edu.cn-15f9db60536bad60/actix-rt-1.1.1/src/system.rs:78:21
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Update to actix-web 4?

I there any easy way to update it to actix-web 4?)

I got few error during the build:

error[E0432]: unresolved imports `actix_web::http::HeaderName`, `actix_web::http::HeaderValue`
 --> src/middleware/auth_middleware.rs:5:12
  |
5 |     http::{HeaderName, HeaderValue, Method},
  |            ^^^^^^^^^^  ^^^^^^^^^^^ no `HeaderValue` in `http`
  |            |
  |            no `HeaderName` in `http`

error[E0277]: the trait bound `fn() -> HttpResponse {ping}: Handler<_>` is not satisfied
   --> src/api/ping_controller.rs:4:4
    |
3   | #[get("/ping")]
    | --------------- required by a bound introduced by this call
4   | fn ping() -> HttpResponse {
    |    ^^^^ the trait `Handler<_>` is not implemented for `fn() -> HttpResponse {ping}`
    |
note: required by a bound in `Resource::<T>::to`
   --> /Users/nshv/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-4.2.1/src/resource.rs:224:12
    |
224 |         F: Handler<Args>,
    |            ^^^^^^^^^^^^^ required by this bound in `Resource::<T>::to`

error[E0277]: the trait bound `actix_web::dev::Response<_>: std::convert::From<BoxBody>` is not satisfied
   --> src/middleware/auth_middleware.rs:109:21
    |
108 |                   Ok(req.into_response(
    |                          ------------- required by a bound introduced by this call
109 | /                     HttpResponse::Unauthorized()
110 | |                         .json(ResponseBody::new(
111 | |                             constants::MESSAGE_INVALID_TOKEN,
112 | |                             constants::EMPTY,
113 | |                         ))
114 | |                         .into_body(),
    | |____________________________________^ the trait `std::convert::From<BoxBody>` is not implemented for `actix_web::dev::Response<_>`
    |
    = help: the following other types implement trait `std::convert::From<T>`:
              <actix_web::dev::Response<&'static [u8]> as std::convert::From<&'static [u8]>>
              <actix_web::dev::Response<&'static str> as std::convert::From<&'static str>>
              <actix_web::dev::Response<B> as std::convert::From<HttpResponse<B>>>
              <actix_web::dev::Response<B> as std::convert::From<ServiceResponse<B>>>
              <actix_web::dev::Response<BoxBody> as std::convert::From<&actix_http::ws::HandshakeError>>
              <actix_web::dev::Response<BoxBody> as std::convert::From<HttpResponseBuilder>>
              <actix_web::dev::Response<BoxBody> as std::convert::From<Infallible>>
              <actix_web::dev::Response<BoxBody> as std::convert::From<Result<I, E>>>
            and 13 others
    = note: required because of the requirements on the impl of `Into<actix_web::dev::Response<_>>` for `BoxBody`
note: required by a bound in `ServiceRequest::into_response`
   --> /Users/nshv/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-4.2.1/src/service.rs:156:32
    |
156 |     pub fn into_response<B, R: Into<Response<B>>>(self, res: R) -> ServiceResponse<B> {
    |                                ^^^^^^^^^^^^^^^^^ required by this bound in `ServiceRequest::into_response`

error[E0277]: the trait bound `Cors: actix_web::dev::Transform<actix_web::app_service::AppRouting, ServiceRequest>` is not satisfied
   --> src/main.rs:60:17
    |
59  |               .wrap(
    |                ---- required by a bound introduced by this call
60  | /                 Cors::default() // allowed_origin return access-control-allow-origin: * by default
61  | |                     .allowed_origin("http://127.0.0.1:3000")
62  | |                     .allowed_origin("http://localhost:3000")
63  | |                     .send_wildcard()
...   |
66  | |                     .allowed_header(http::header::CONTENT_TYPE)
67  | |                     .max_age(3600),
    | |__________________________________^ the trait `actix_web::dev::Transform<actix_web::app_service::AppRouting, ServiceRequest>` is not implemented for `Cors`
    |
    = help: the following other types implement trait `actix_web::dev::Transform<S, Req>`:
              <Arc<T> as actix_web::dev::Transform<S, Req>>
              <Compress as actix_web::dev::Transform<S, ServiceRequest>>
              <Condition<T> as actix_web::dev::Transform<S, Req>>
              <DefaultHeaders as actix_web::dev::Transform<S, ServiceRequest>>
              <ErrorHandlers<B> as actix_web::dev::Transform<S, ServiceRequest>>
              <NormalizePath as actix_web::dev::Transform<S, ServiceRequest>>
              <Rc<T> as actix_web::dev::Transform<S, Req>>
              <actix_service::transform_err::TransformMapInitErr<T, S, Req, F, E> as actix_web::dev::Transform<S, Req>>
            and 2 others
note: required by a bound in `App::<T>::wrap`
   --> /Users/nshv/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-4.2.1/src/app.rs:364:12
    |
364 |           M: Transform<
    |  ____________^
365 | |                 T::Service,
366 | |                 ServiceRequest,
367 | |                 Response = ServiceResponse<B>,
368 | |                 Error = Error,
369 | |                 InitError = (),
370 | |             > + 'static,
    | |_____________^ required by this bound in `App::<T>::wrap`

warning: use of deprecated associated function `actix_web::App::<T>::data`: Use `.app_data(Data::new(val))` instead.
  --> src/main.rs:69:14
   |
69 |             .data(pool.clone())
   |              ^^^^
   |
   = note: `#[warn(deprecated)]` on by default

error[E0277]: the trait bound `Authentication: actix_web::dev::Transform<<impl actix_web::dev::ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse<actix
_web::middleware::logger::StreamLog<_>>, Error = actix_web::Error, InitError = ()> as actix_web::dev::ServiceFactory<ServiceRequest>>::Service, ServiceRequest>` is not sat
isfied
   --> src/main.rs:71:19
    |
71  |             .wrap(crate::middleware::auth_middleware::Authentication) // Comment this line of code if you want to integrate with yew-addr...
    |              ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `actix_web::dev::Transform<<impl actix_web::dev::ServiceFactory<ServiceRequest, Config
 = (), Response = ServiceResponse<actix_web::middleware::logger::StreamLog<_>>, Error = actix_web::Error, InitError = ()> as actix_web::dev::ServiceFactory<ServiceRequest>
>::Service, ServiceRequest>` is not implemented for `Authentication`
    |              |
    |              required by a bound introduced by this call
    |
    = help: the following other types implement trait `actix_web::dev::Transform<S, Req>`:
              <Arc<T> as actix_web::dev::Transform<S, Req>>
              <Compress as actix_web::dev::Transform<S, ServiceRequest>>
              <Condition<T> as actix_web::dev::Transform<S, Req>>
              <DefaultHeaders as actix_web::dev::Transform<S, ServiceRequest>>
              <ErrorHandlers<B> as actix_web::dev::Transform<S, ServiceRequest>>
              <NormalizePath as actix_web::dev::Transform<S, ServiceRequest>>
              <Rc<T> as actix_web::dev::Transform<S, Req>>
              <actix_service::transform_err::TransformMapInitErr<T, S, Req, F, E> as actix_web::dev::Transform<S, Req>>
            and 2 others
note: required by a bound in `App::<T>::wrap`
   --> /Users/nshv/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-4.2.1/src/app.rs:364:12
    |
364 |           M: Transform<
    |  ____________^
365 | |                 T::Service,
366 | |                 ServiceRequest,
367 | |                 Response = ServiceResponse<B>,
368 | |                 Error = Error,
369 | |                 InitError = (),
370 | |             > + 'static,
    | |_____________^ required by this bound in `App::<T>::wrap`

error[E0599]: the method `call` exists for reference `&<impl actix_web::dev::ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse<_>, Error = actix_web::
Error, InitError = ()> as actix_web::dev::ServiceFactory<ServiceRequest>>::Service`, but its trait bounds were not satisfied
  --> src/main.rs:72:37
   |
72 |             .wrap_fn(|req, srv| srv.call(req).map(|res| res))
   |                                     ^^^^ method cannot be called on `&<impl actix_web::dev::ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse<_>,
 Error = actix_web::Error, InitError = ()> as actix_web::dev::ServiceFactory<ServiceRequest>>::Service` due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `<impl actix_web::dev::ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse<_>, Error = actix_web::Error, InitError = ()> as actix_web::dev::S
erviceFactory<ServiceRequest>>::Service: Fn<_>`
           which is required by `&<impl actix_web::dev::ServiceFactory<ServiceRequest, Config = (), Response = ServiceResponse<_>, Error = actix_web::Error, InitError = ()
> as actix_web::dev::ServiceFactory<ServiceRequest>>::Service: Fn<_>`
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
3  | use crate::actix_web::dev::Service;
   |

warning: unused import: `futures::FutureExt`
  --> src/main.rs:40:5
   |
40 | use futures::FutureExt;
   |     ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: unused import: `actix_service::Service`
  --> src/main.rs:38:5
   |
38 | use actix_service::Service;
   |     ^^^^^^^^^^^^^^^^^^^^^^

Some errors have detailed explanations: E0277, E0432, E0599.
For more information about an error, try `rustc --explain E0277`.
warning: `actix-web-rest-api-with-jwt` (bin "actix-web-rest-api-with-jwt") generated 3 warnings
error: could not compile `actix-web-rest-api-with-jwt` due to 6 previous errors; 3 warnings emitted

How to get User data in controllers?

Hi,

First of all I would like to say that this repository is a really nice example of implementing JWT for Actix. It is a really helpful resource to start playing with Actix, thank you for your work.

If you have a minute to spare would you be able to suggest how to pass JWT token to the different controllers? What I would like to achieve is to have a way of extracting user_id from incoming request to automatically create relation between models and user that is creating them in the app, without a need to send user_id with every request from frontend.

If you don't want to or do not have time to, feel free to close this issue :)

Can't exec wait-for-it.sg

image

Hi! I exec docker compose at local and I can't exec the .sh. Above is the error image. Could you explain why? I tried with sudo also and same error.

How to make middleware support async fucntion call?

Your project very good skeleton of Actix Web rest API especially your Middleware jwt concept , I have changed to support other database library beside diesel , every thing work fine but I have one issue because of new database library need to working on async example token_utils::verify_token(&token_data, pool).await in file name auth_middleware.rs I hard to call it or how make it works in middleware.
I hope get your help
Thank you

Docker build error

Step 10/19 : RUN rm ./target/release/deps/actix_web_rest_api_with_jwt*;     cargo build --release
 ---> Running in 2c13bce0bc9a
rm: cannot remove './target/release/deps/actix_web_rest_api_with_jwt*': No such file or directory
   Compiling migrations_macros v1.4.2
   Compiling actix-connect v2.0.0
   Compiling actix-http v2.1.0
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.0.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.1.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.10.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.11.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.12.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.13.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.14.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.15.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.2.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.3.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.4.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.5.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.6.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.7.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.8.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.migrations_macros.8uzsnkrf-cgu.9.rcgu.o" "-o" "/app/target/release/deps/libmigrations_macros-fadaadeab581f780.so" "/app/target/release/deps/migrations_macros-fadaadeab581f780.4a7fc84kdbhygpn1.rcgu.o" "/app/target/release/deps/migrations_macros-fadaadeab581f780.39u2d4eyt0em7h1g.rcgu.o" "-Wl,--gc-sections" "-shared" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/app/target/release/deps" "-L" "/usr/lib/x86_64-linux-gnu" "-L" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/app/target/release/deps/libsyn-49d5112fbab80ab7.rlib" "/app/target/release/deps/libquote-2be1e76992997c83.rlib" "/app/target/release/deps/libproc_macro2-c85bd876b72519c4.rlib" "/app/target/release/deps/libunicode_xid-8663f59690402b5f.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-8975dabc5e7e4cfc.rlib" "/app/target/release/deps/libmigrations_internals-86d9a50d9b9eb1a1.rlib" "/app/target/release/deps/libdiesel-31f8b466bfad945b.rlib" "/app/target/release/deps/liblibsqlite3_sys-f9bc70751cec2dd6.rlib" "/app/target/release/deps/libpq_sys-3f41eabf954f0f9e.rlib" "/app/target/release/deps/libchrono-1440cb9e8b9ec093.rlib" "/app/target/release/deps/libserde-30b28169d4953485.rlib" "/app/target/release/deps/libnum_integer-954c7c5dc74de8b2.rlib" "/app/target/release/deps/libnum_traits-bac497dc21ff48bd.rlib" "/app/target/release/deps/libtime-5656809522972b8c.rlib" "/app/target/release/deps/libr2d2-1b2d10203b26c854.rlib" "/app/target/release/deps/libscheduled_thread_pool-b391843d611afae2.rlib" "/app/target/release/deps/libparking_lot-0ba472e40b20f1ad.rlib" "/app/target/release/deps/libparking_lot_core-fc1917ca1b019cec.rlib" "/app/target/release/deps/liblibc-55d7ced54f21c4a3.rlib" "/app/target/release/deps/libsmallvec-8ed215ffb5a01ac4.rlib" "/app/target/release/deps/liblock_api-dc555b5792d32d68.rlib" "/app/target/release/deps/libscopeguard-7960dfc10554893d.rlib" "/app/target/release/deps/libinstant-322f0e9f791896ac.rlib" "/app/target/release/deps/libcfg_if-e87b58d2de662d30.rlib" "/app/target/release/deps/liblog-ad859a5ddc9be878.rlib" "/app/target/release/deps/libcfg_if-3b1df0a1ef4b649d.rlib" "/app/target/release/deps/libbyteorder-655becf0e7bd92aa.rlib" "/app/target/release/deps/libbitflags-02f6fb34a765e434.rlib" "-Wl,--start-group" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-f14aca24435a5414.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-48d342a8b48d1d01.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-14bc0820888c8eb3.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-9cbd9e217bff06bc.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-31826136df98934e.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-075976a117c8fd5d.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-2d5cbedfbf17a011.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-0474372ff08c5319.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-d437c34460d2315a.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-fb61ed1b8cc4de79.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-bf76d1b643bfc9f0.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-a1b53aa7fddcf418.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-28585e57fac45c73.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-64801769bc15ab28.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-541997b56bb98660.rlib" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-cdea3c81adab3d12.rlib" "-Wl,--end-group" "/usr/local/rustup/toolchains/1.47.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-cd9f15a39fb65cbc.rlib" "-Wl,-Bdynamic" "-lsqlite3" "-lpq" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-ldl" "-lutil"
  = note: /usr/bin/ld: cannot find -lsqlite3
          collect2: error: ld returned 1 exit status


error: aborting due to previous error

error: could not compile `migrations_macros`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
ERROR: Service 'app' failed to build : The command '/bin/sh -c rm ./target/release/deps/actix_web_rest_api_with_jwt*;     cargo build --release' returned a non-zero code: 101

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.