Skip to content

Instantly share code, notes, and snippets.

@viktorfa

viktorfa/server.js

Last active Aug 16, 2020
Embed
What would you like to do?
Server config for Strapi in Serverless
// config/server.js
// This config is used both in `strapi build` and `strapi start`.
// So if we have a path prefix to the api, such as /dev or /v1,
// we need to use env variables to configure, as Strapi doesn't
// support path prefixes automagically.
module.exports = ({ env }) => {
let url = "<Insert Lambda endpoint url here after deploy.>";
// Check if running in serverless-offline
if (env("IS_OFFLINE", null) === "true") {
url = "http://localhost:3000/dev";
}
return {
host: env("HOST", "0.0.0.0"),
port: env.int("PORT", 1337),
url,
admin: {
serveAdminPanel: false, // No admin panel
autoOpen: false,
url: "/",
auth: {
secret: env("ADMIN_JWT_SECRET", "Insert random string as env variable in production"),
},
},
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment