nocode
Search…
Configs

Configs

The first thing to do is get your configs set up. The database connection is all you really need.
1
{
2
"port": 3030, // api port
3
"database": {
4
"dialect": "mysql",
5
"user": "", // db username
6
"password": "", // db password
7
"host": "", // db host
8
"database": "" // name of the database
9
},
10
"default_from_email": "[email protected]", // for emails!
11
"sendgrid": "", // to send emails!
12
"auth": {
13
"allowed_origins": [], // an array of allowed origins like ["http://localhost:3000"]
14
"issuer": "noco", // anything will do here
15
"audience": "noco", // anything will do here for,
16
"expiresIn": 10000 // number of seconds the JWT is good for.
17
},
18
"s3": {
19
"key": "",
20
"secret": "",
21
"bucket": "",
22
"region": "",
23
"s3ForcePathStyle": true,
24
"signatureVersion": "v4",
25
"endpoint": ""
26
}
27
}
Copied!
If you need a simple local mysql database you can use docker to quickly set one up.
1
docker run -ti -p 3306:3306 \
2
-v $(PWD)/sql:/var/lib/mysql \
3
-e MYSQL_ROOT_PASSWORD=password \
4
mysql:5.7
Copied!
You'll then need to use something like Sequel Pro to create a database to connect to. Let's say you create a data
Then your local configs could look something like this.
1
"database": {
2
"dialect": "mysql",
3
"user": "root",
4
"password": "password",
5
"host": "0.0.0.0",
6
"database": "test"
7
},
Copied!
If you want to use another one of Sequelize's databases, you'll need to install the adapter yourself. Take a look at their docs https://sequelize.org/master/manual/getting-started.html
Next up it's time to install the node modules
npm i
After your node modules are installed, you can run npm run docsto generate your own API documentation.
You're then ready to run your API with npm run dev
1
# Successful output of your api once you've set your configs
2
API on port 3030!
3
mysql connected
4
bootstrapped api key!
Copied!
If you head over to http://localhost:3030 you should see your documentation. It will look something like this:
your beautiful new docs!
Last modified 1yr ago
Copy link