Example Multicolour App with Hapi server, Mongo and OAuth.
This example app will connect to your Mongo database server, if you haven't used Mongo before or don't have a server to connect to, please read the Mongo Getting Started documentation to get your own Mongo server up.
If you already have a Mongo server running, following these steps will get your server up and running.
- Update the database configuration to your Mongo connection settings in
config.js
. - Run
npm i
in the terminal to get the dependencies for the app. - To use the auth plugin you'll need a registered app on the service you want to use and to add your configuration to
config.js
, also uncomment line #18 inapp.js
to enable the module.
Running npm start
will start the server up and if your NODE_ENV
is "development"
it will automatically seed your database with random data. This seed will happen every time you start the server unless you comment out line #14 in config.js
.
Once you get the "Server running at: http://your-server:1811"
message you can view the Swagger docs by visiting http://localhost:1811/docs.
Edit and create blueprints in the content/blueprints
to add/edit/remove endpoints from your API.
To learn more about the structure of these schemas, see the Multicolour blueprint documentation or to read about how to add custom routes
Read more on the Multicolour wiki
You don't have to, Multicolour uses Waterline as it's ORM and you can switch your database tech per environment, per blueprint, however you like. Below is a list of officially supported adapters:
sails-disk
sails-memory
sails-redis
sails-postgresql
sails-mongo
sails-mysql
sails-arango
Simply update the require("sails-mongo")
on line #69 of config.js
and update the connection details.
MIT 2016