Skip to content

Simple AWS Lambda REST API in Node.js with Serverless.

License

Notifications You must be signed in to change notification settings

antogno/omninext

Repository files navigation

Omninext

License Last commit Last release

Simple AWS Lambda REST API in Node.js with Serverless.


Table of contents

Usage

You can access the API at https://g5x6nvsdj3.execute-api.us-east-1.amazonaws.com.

Pre-requisites

Install Serverless:

$ npm i -g serverless

You'll also need Java and AWS CLI.

Setup

Install the dependencies:

$ npm i

Run the following command:

$ npm run init

Configure AWS credentials by running the following command:

$ aws configure

You can put any value for the access key ID and the secret access key. All that matters is the region name that must be "local":

AWS Access Key ID [None]: dev
AWS Secret Access Key [None]: dev
Default region name [None]: local
Default output format [None]:

When asked about the default output format, you can type "json" or just press enter.

Run

$ npm run dev

The API is now accessible at localhost:3000.

Deploy

To deploy this entire service via Serverless you must follow the following steps.

First, login with Serverless:

$ sls login

Then add the following two properties at the top of the serverless.yml file:

org: <name of your org>
app: omninext

Lastly, run:

$ npm run deploy

Now you should be able to access the API through a URL similar to https://g5x6nvsdj3.execute-api.us-east-1.amazonaws.com.

Docs

$ npm run docs

The documentation is now accessible at localhost:4000.

License

Omninext is licensed under the terms of the Creative Commons Zero v1.0 Universal license.

For more information, see the Creative Commons website.