Configuration
Basic Config
The config is simple ! You will see a quickstart config !
{
"database": {
"host": "localhost",
"user": "root",
"pass": "root",
"name": "towny"
},
"port": 7000,
"baseURL": "api",
"residentURL": "resident",
"townURL": "town",
"nationURL": "nation",
"welcomePhrase": "Welcome on servername Towny Data API !",
"logConnections": true,
"maxSize": 5000
}Just edit the database informations, and others if you want (See more here)
Then you can execute node index.js !
Advanced Config
Line par Line explaination
Database config, set the host, the user, the password and the database name :
Change the port of the express server : (Int)
Base URL of your api (yourdomain/baseURL) : (String)
URL for resident requests (yourdomain/baseURL/residentURL) : (String)
URL for town requests (yourdomain/baseURL/townURL) : (String)
URL for resident requests (yourdomain/baseURL/nationURL) : (String)
Welcome phrase on yourdomain and yourdomain/api : (String)
Do you want connections to be logged (No IP for sure) : (Boolean)
Max request size, for mass requests like fetch residents : (Int)
That's all !
Let's see how our API works :
Last updated
Was this helpful?