# Serverless vs AWS SAM (aws-serverless-express)

**URL:** <https://forum.serverless.com/t/serverless-vs-aws-sam-aws-serverless-express/2784>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [September 27, 2017, 8:06pm UTC](https://forum.serverless.com/t/serverless-vs-aws-sam-aws-serverless-express/2784 "2017-09-27T20:06:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![richburdon](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/richburdon/32/1208_2.png) [@richburdon](https://forum.serverless.com/u/richburdon)\
**Post date:** [September 27, 2017, 8:06pm UTC](https://forum.serverless.com/t/serverless-vs-aws-sam-aws-serverless-express/2784/1 "2017-09-27T20:06:15Z")

</div>

The aws-serverless-express README is nice and simple and you can quickly get up and running with a single endpoint, single-path express app. Then there’s a quantum leap to their “example” which seems the ditch the serverless.yml file and explode in complexity to the AWS SAM configuration, which seems to obviate the nice abstractions that serverless makes.

Is there a simpler “pure” serverless.yml way to configure AWS/Express and/or is this an attempt by AWS to take-over serverless by with AWS lock-in configurations?

---

<div class="post-metadata">

**Author:** ![alexdebrie1](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/alexdebrie1/32/899_2.png) [@alexdebrie1](https://forum.serverless.com/u/alexdebrie1)\
**Post date:** [September 27, 2017, 9:49pm UTC](https://forum.serverless.com/t/serverless-vs-aws-sam-aws-serverless-express/2784/2 "2017-09-27T21:49:58Z")

</div>

Hey @richburdon, there sure is! You should check out the awesome [serverless-http plugin](https://github.com/dougmoscrop/serverless-http) to work with that.

You can get started with the following steps:

1. Install `serverless-http` by running: `npm install --save serverless-http`

2. Update your Express index file. You’ll need to import the `serverless-http` library at the top of your file:

`const serverless = require('serverless-http');`

then export your wrapped application:

`module.exports.handler = serverless(app);`.

For reference, an example application might look like this:

```javascript
#index.js

const serverless = require('serverless-http');
const express = require('express')
const app = express()

app.get('/', function (req, res) {
  res.send('Hello World!')
})

app.get('/:name', function (req, res) {
  res.send(`Hello ${req.params.name}!`)
})

module.exports.handler = serverless(app);

```

1. Set up your `serverless.yml`. You can use a single function that captures all traffic:

```auto
# serverless.yml

service: express-app

provider:
  name: aws
  runtime: nodejs6.10
  stage: dev
  region: us-east-1

functions:
  app:
    handler: index.handler
    events:
      - http: ANY /
      - http: 'ANY {proxy+}'

```

Just make sure your `handler` refers to the file and exported function of your Express app.

Let me know if that works for you!

---

<div class="post-metadata">

**Author:** ![HintikkaKimmo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/hintikkakimmo/32/797_2.png) [@HintikkaKimmo](https://forum.serverless.com/u/HintikkaKimmo)\
**Post date:** [May 9, 2018, 7:51am UTC](https://forum.serverless.com/t/serverless-vs-aws-sam-aws-serverless-express/2784/3 "2018-05-09T07:51:48Z")

</div>

So in this example if I just wanted to work with get functions I could call handler.get in serverless.yml? Also I could name it app rather than handler? Do nderstand this correctly?

Does similar package existing for python as well? I tried wsgi wrapper but ran into some issues. I’m just more fluent in Python than js
