(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{225:function(t,e,a){"use strict";a.r(e);var s=a(0),n=Object(s.a)({},function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"content"},[t._m(0),t._v(" "),a("hr"),t._v(" "),t._m(1),t._v(" "),a("hr"),t._v(" "),a("p",[t._v("Strapi is an open-source Node.js rich framework for building applications and services.")]),t._v(" "),a("p",[t._v("Strapi enables developers to focus on writing reusable application logic instead of spending time\nbuilding infrastructure. It is designed for building practical, production-ready Node.js applications\nin a matter of hours instead of weeks.")]),t._v(" "),a("p",[t._v("The framework sits on top of "),a("a",{attrs:{href:"http://koajs.com/",target:"_blank",rel:"noopener noreferrer"}},[t._v("Koa"),a("OutboundLink")],1),t._v(". Its ensemble of small modules work\ntogether to provide simplicity, maintainability, and structural conventions to Node.js applications.")]),t._v(" "),t._m(2),t._v(" "),t._m(3),t._v(" "),a("p",[t._v("Install the latest stable release with the npm command-line tool:")]),t._v(" "),t._m(4),t._m(5),t._v(" "),a("p",[t._v("You now are able to use the Strapi CLI. Simply create your first application and start the server:")]),t._v(" "),t._m(6),a("p",[t._v("The default home page is accessible at "),a("a",{attrs:{href:"http://localhost:1337/",target:"_blank",rel:"noopener noreferrer"}},[t._v("http://localhost:1337/"),a("OutboundLink")],1),t._v(".")]),t._v(" "),t._m(7),t._v(" "),t._m(8),t._m(9),t._v(" "),t._m(10),t._m(11),t._v(" "),t._m(12),t._v(" "),t._m(13),t._v(" "),t._m(14),a("p",[t._v("This will generate a Strapi application without:")]),t._v(" "),t._m(15),t._v(" "),a("p",[t._v("This feature allows you to only use Strapi for your HTTP server structure if you want to.")]),t._v(" "),t._m(16),t._v(" "),a("p",[t._v("The Strapi Studio allows you to easily build and manage your application environment\nthanks to a powerful User Interface.")]),t._v(" "),a("p",[t._v("Log into the Strapi Studio with your user account ("),a("a",{attrs:{href:"http://studio.strapi.io",target:"_blank",rel:"noopener noreferrer"}},[t._v("http://studio.strapi.io"),a("OutboundLink")],1),t._v(")\nand follow the instructions to start the experience.")]),t._v(" "),t._m(17),t._v(" "),a("blockquote",[a("p",[t._v("We advise you to use our Studio to build APIs. To do so, you need to create a Strapi account.\n"),a("a",{attrs:{href:"http://studio.strapi.io",target:"_blank",rel:"noopener noreferrer"}},[t._v("Go to the Strapi Studio to signup"),a("OutboundLink")],1),t._v(".\nStudio is dedicated to developers to build applications without writing\nany single line of code thanks to its powerful set of tools.")])]),t._v(" "),a("p",[t._v("After creating an account on the Strapi Studio, you are able to link your machine to your\nStrapi Studio account to get access to all features offered by the Strapi ecosystem.\nUse your Strapi account credentials.")]),t._v(" "),t._m(18),t._m(19),t._v(" "),t._m(20),t._v(" "),a("p",[t._v("Building on top of Strapi means your application is written entirely in JavaScript,\nthe language you and your team are already using in the browser.")]),t._v(" "),a("p",[t._v("Since you spend less time context-shifting, you're able to write code in a more consistent style,\nwhich makes development more productive.")]),t._v(" "),a("p",[t._v("The entire Strapi framework is written in ES2015.")]),t._v(" "),t._m(21),t._v(" "),a("p",[t._v("Strapi provides a robust layer for fundamental web applications to help you write your business\nlogic, without obscuring Node.js features that you know and love. Our goal is to make writing\nbusiness logic much easier than other frameworks.")]),t._v(" "),t._m(22),t._v(" "),a("p",[t._v("Strapi comes with a generator that help jumpstart your application's backend without writing any code. Just run:")]),t._v(" "),t._m(23),a("p",[t._v("and you'll get an API that lets you read, paginate, sort, filter, create, destroy, update,\nand associate cars.")]),t._v(" "),t._m(24),t._v(" "),a("p",[t._v("We take security very seriously. This is why Strapi comes with several security layers that just work\ndepending on your needs. Strapi provides configuration for CORS, CSRF, CSP, X-Frame-Options, XSS, HSTS,\nHTTPS, SSL, proxy, IP filtering and ships reusable security policies.")]),t._v(" "),a("p",[t._v("No matter what you need to secure, Strapi is the right tool to make it right.")]),t._v(" "),t._m(25),t._v(" "),a("p",[t._v("Strapi comes installed with a powerful ORM/ODM called Waterline, a datastore-agnostic tool that\ndramatically simplifies interaction with one or more databases.")]),t._v(" "),a("p",[t._v("It provides an abstraction layer on top of the underlying database, allowing you to easily query\nand manipulate your data without writing vendor-specific integration code.")]),t._v(" "),a("p",[t._v("Strapi offers a new take on the familiar relational model, aimed at making data modeling more practical.\nYou can do all the same things you might be used to (one-to-many, many-to-many), but you can also assign\nmultiple named associations per-model. Better yet, you can assign different models to different databases,\nand your associations/joins will still work, even across NoSQL and relational boundries.")]),t._v(" "),a("p",[t._v("Strapi has no problem implicitly/automatically joining a SQL table with a NoSQL collection and vice versa.")]),t._v(" "),t._m(26),t._v(" "),a("p",[t._v("Strapi is compatible with any front-end strategy; whether it's Angular, Backbone, Ember,\niOS, Android, Windows Phone, or something else that hasn't been invented yet.")]),t._v(" "),a("p",[t._v("Plus it's easy to serve up the same API to be consumed by another web service or community of developers.")]),t._v(" "),t._m(27),t._v(" "),a("p",[t._v("Convention over configuration is a consistent approach makes developing applications more\npredictable and efficient for everybody involved.")]),t._v(" "),a("p",[t._v("If anyone on your team has worked with frameworks, Strapi will feel pretty familiar.\nNot only that, but they can look at a Strapi project and know, generally, how to code up the basic\npatterns they've implemented over and over again in the past; whether their background.\nWhat about your second application, or your third? Each time you create a new Strapi application,\nyou start with a sane, familiar boilerplate that makes you more productive.")]),t._v(" "),a("p",[t._v("Configuration files give you extra opportunities for human error.")]),t._v(" "),a("p",[t._v("In many cases, you'll even be able to recycle some of your code.")]),t._v(" "),t._m(28),t._v(" "),t._m(29),t._v(" "),t._m(30),t._m(31),t._v(" "),t._m(32),a("p",[t._v('When an error occurs and it is still possible to respond to the client,\naka no data has been written to the socket, Strapi will respond appropriately with\na 500 "Internal Server Error". In either case an app-level "error" is emitted for logging purposes.')]),t._v(" "),t._m(33),t._v(" "),a("p",[t._v("Strapi has built in support for the idea of having a different set of settings for each environment.\nReal applications have this too, but often the framework around them doesn't accommodate it and\nyou end up having to swap configuration files in and out to achieve the same effect.")]),t._v(" "),t._m(34),t._v(" "),a("p",[t._v("Strapi is flexible enough to allow you to explore and create when you have the time to but also\nprovides automation tools when you don't.")])])},[function(){var t=this.$createElement,e=this._self._c||t;return e("h1",{attrs:{id:"introduction"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#introduction","aria-hidden":"true"}},[this._v("#")]),this._v(" Introduction")])},function(){var t=this.$createElement,e=this._self._c||t;return e("p",[this._v("Important Note: "),e("strong",[this._v("Strapi 1.x is on maintenance only")]),this._v(". Development focuses on the upcoming Strapi 3.0.")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h2",{attrs:{id:"getting-started"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#getting-started","aria-hidden":"true"}},[this._v("#")]),this._v(" Getting Started")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"installation"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#installation","aria-hidden":"true"}},[this._v("#")]),this._v(" Installation")])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"language-bash extra-class"},[e("pre",{pre:!0,attrs:{class:"language-bash"}},[e("code",[this._v("$ "),e("span",{attrs:{class:"token function"}},[this._v("npm")]),this._v(" "),e("span",{attrs:{class:"token function"}},[this._v("install")]),this._v(" strapi -g\n")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"create-your-first-project"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#create-your-first-project","aria-hidden":"true"}},[this._v("#")]),this._v(" Create your first project")])},function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"language-bash extra-class"},[a("pre",{pre:!0,attrs:{class:"language-bash"}},[a("code",[t._v("$ strapi new "),a("span",{attrs:{class:"token operator"}},[t._v("<")]),t._v("appName"),a("span",{attrs:{class:"token operator"}},[t._v(">")]),t._v("\n$ "),a("span",{attrs:{class:"token function"}},[t._v("cd")]),t._v(" "),a("span",{attrs:{class:"token operator"}},[t._v("<")]),t._v("appName"),a("span",{attrs:{class:"token operator"}},[t._v(">")]),t._v("\n$ strapi start\n")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"create-your-first-api"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#create-your-first-api","aria-hidden":"true"}},[this._v("#")]),this._v(" Create your first API")])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"language-bash extra-class"},[e("pre",{pre:!0,attrs:{class:"language-bash"}},[e("code",[this._v("$ strapi generate api "),e("span",{attrs:{class:"token operator"}},[this._v("<")]),this._v("apiName"),e("span",{attrs:{class:"token operator"}},[this._v(">")]),this._v("\n")])])])},function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("p",[t._v("For example, you can create a "),a("code",[t._v("car")]),t._v(" API with a name ("),a("code",[t._v("name")]),t._v("), year ("),a("code",[t._v("year")]),t._v(") and\nthe license plate ("),a("code",[t._v("license")]),t._v(") with:")])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"language-bash extra-class"},[e("pre",{pre:!0,attrs:{class:"language-bash"}},[e("code",[this._v("$ strapi generate api car name:string year:integer license:string\n")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("h2",{attrs:{id:"alternatives"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#alternatives","aria-hidden":"true"}},[this._v("#")]),this._v(" Alternatives")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"dry-application"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#dry-application","aria-hidden":"true"}},[this._v("#")]),this._v(" Dry Application")])},function(){var t=this.$createElement,e=this._self._c||t;return e("p",[this._v("Note that you can generate a dry application using the "),e("code",[this._v("dry")]),this._v(" option:")])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"language-bash extra-class"},[e("pre",{pre:!0,attrs:{class:"language-bash"}},[e("code",[this._v("$ strapi new "),e("span",{attrs:{class:"token operator"}},[this._v("<")]),this._v("appName"),e("span",{attrs:{class:"token operator"}},[this._v(">")]),this._v(" --dry\n")])])])},function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("ul",[a("li",[t._v("the built-in "),a("code",[t._v("user")]),t._v(", "),a("code",[t._v("email")]),t._v(" and "),a("code",[t._v("upload")]),t._v(" APIs,")]),t._v(" "),a("li",[t._v("the "),a("code",[t._v("grant")]),t._v(" hook,")]),t._v(" "),a("li",[t._v("the open-source admin panel,")]),t._v(" "),a("li",[t._v("the Waterline ORM ("),a("code",[t._v("waterline")]),t._v(" and "),a("code",[t._v("blueprints")]),t._v(" hooks disabled),")]),t._v(" "),a("li",[t._v("the Strapi Studio connection ("),a("code",[t._v("studio")]),t._v(" hook disabled).")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"create-an-api-via-the-strapi-studio"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#create-an-api-via-the-strapi-studio","aria-hidden":"true"}},[this._v("#")]),this._v(" Create an API via the Strapi Studio")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"link-to-the-strapi-studio"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#link-to-the-strapi-studio","aria-hidden":"true"}},[this._v("#")]),this._v(" Link to the Strapi Studio")])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"language-bash extra-class"},[e("pre",{pre:!0,attrs:{class:"language-bash"}},[e("code",[this._v("$ strapi login\n")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("h2",{attrs:{id:"key-features"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#key-features","aria-hidden":"true"}},[this._v("#")]),this._v(" Key-features")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"_100-javascript"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#_100-javascript","aria-hidden":"true"}},[this._v("#")]),this._v(" 100% JavaScript")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"getting-started-quickly"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#getting-started-quickly","aria-hidden":"true"}},[this._v("#")]),this._v(" Getting started quickly")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"auto-generate-rest-apis"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#auto-generate-rest-apis","aria-hidden":"true"}},[this._v("#")]),this._v(" Auto-generate REST APIs")])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"language-bash extra-class"},[e("pre",{pre:!0,attrs:{class:"language-bash"}},[e("code",[this._v("$ strapi generate api car\n")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"security"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#security","aria-hidden":"true"}},[this._v("#")]),this._v(" Security")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"datastore-agnostic"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#datastore-agnostic","aria-hidden":"true"}},[this._v("#")]),this._v(" Datastore-agnostic")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"front-end-agnostic"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#front-end-agnostic","aria-hidden":"true"}},[this._v("#")]),this._v(" Front-end agnostic")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"convention-over-configuration"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#convention-over-configuration","aria-hidden":"true"}},[this._v("#")]),this._v(" Convention over configuration")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"error-handling"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#error-handling","aria-hidden":"true"}},[this._v("#")]),this._v(" Error Handling")])},function(){var t=this.$createElement,e=this._self._c||t;return e("p",[this._v("By default outputs all errors to "),e("code",[this._v("stderr")]),this._v(" unless "),e("code",[this._v("NODE_ENV")]),this._v(" is "),e("code",[this._v("test")]),this._v('.\nTo perform custom error-handling logic such as centralized logging you can add an "error" event listener:')])},function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[t._v("strapi"),a("span",{attrs:{class:"token punctuation"}},[t._v(".")]),t._v("app"),a("span",{attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{attrs:{class:"token function"}},[t._v("on")]),a("span",{attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{attrs:{class:"token string"}},[t._v("'error'")]),a("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{attrs:{class:"token punctuation"}},[t._v("(")]),t._v("err"),a("span",{attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n strapi"),a("span",{attrs:{class:"token punctuation"}},[t._v(".")]),t._v("log"),a("span",{attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{attrs:{class:"token function"}},[t._v("error")]),a("span",{attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{attrs:{class:"token string"}},[t._v("'server error'")]),a("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" err"),a("span",{attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),a("span",{attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("p",[this._v("If an error in the req/res cycle and it is not possible to respond to the client,\nthe "),e("code",[this._v("Context")]),this._v(" instance is also passed:")])},function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"language-js extra-class"},[a("pre",{pre:!0,attrs:{class:"language-js"}},[a("code",[t._v("strapi"),a("span",{attrs:{class:"token punctuation"}},[t._v(".")]),t._v("app"),a("span",{attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{attrs:{class:"token function"}},[t._v("on")]),a("span",{attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{attrs:{class:"token string"}},[t._v("'error'")]),a("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{attrs:{class:"token punctuation"}},[t._v("(")]),t._v("err"),a("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" ctx"),a("span",{attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n strapi"),a("span",{attrs:{class:"token punctuation"}},[t._v(".")]),t._v("log"),a("span",{attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{attrs:{class:"token function"}},[t._v("error")]),a("span",{attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{attrs:{class:"token string"}},[t._v("'server error'")]),a("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" err"),a("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" ctx"),a("span",{attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n"),a("span",{attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"different-environments"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#different-environments","aria-hidden":"true"}},[this._v("#")]),this._v(" Different environments")])},function(){var t=this.$createElement,e=this._self._c||t;return e("h3",{attrs:{id:"loose-coupling"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#loose-coupling","aria-hidden":"true"}},[this._v("#")]),this._v(" Loose coupling")])}],!1,null,null,null);n.options.__file="introduction.md";e.default=n.exports}}]);