diff --git a/app.js b/app.js new file mode 100644 index 0000000..3bb2fd7 --- /dev/null +++ b/app.js @@ -0,0 +1,41 @@ +var createError = require('http-errors'); +var express = require('express'); +var path = require('path'); +var cookieParser = require('cookie-parser'); +var logger = require('morgan'); + +var indexRouter = require('./routes/index'); +var usersRouter = require('./routes/users'); + +var app = express(); + +// view engine setup +app.set('views', path.join(__dirname, 'views')); +app.set('view engine', 'twig'); + +app.use(logger('dev')); +app.use(express.json()); +app.use(express.urlencoded({ extended: false })); +app.use(cookieParser()); +app.use(express.static(path.join(__dirname, 'public'))); + +app.use('/', indexRouter); +app.use('/users', usersRouter); + +// catch 404 and forward to error handler +app.use(function(req, res, next) { + next(createError(404)); +}); + +// error handler +app.use(function(err, req, res, next) { + // set locals, only providing error in development + res.locals.message = err.message; + res.locals.error = req.app.get('env') === 'development' ? err : {}; + + // render the error page + res.status(err.status || 500); + res.render('error'); +}); + +module.exports = app; diff --git a/bin/www b/bin/www new file mode 100644 index 0000000..fa15f15 --- /dev/null +++ b/bin/www @@ -0,0 +1,90 @@ +#!/usr/bin/env node + +/** + * Module dependencies. + */ + +var app = require('../app'); +var debug = require('debug')('australia:server'); +var http = require('http'); + +/** + * Get port from environment and store in Express. + */ + +var port = normalizePort(process.env.PORT || '3000'); +app.set('port', port); + +/** + * Create HTTP server. + */ + +var server = http.createServer(app); + +/** + * Listen on provided port, on all network interfaces. + */ + +server.listen(port); +server.on('error', onError); +server.on('listening', onListening); + +/** + * Normalize a port into a number, string, or false. + */ + +function normalizePort(val) { + var port = parseInt(val, 10); + + if (isNaN(port)) { + // named pipe + return val; + } + + if (port >= 0) { + // port number + return port; + } + + return false; +} + +/** + * Event listener for HTTP server "error" event. + */ + +function onError(error) { + if (error.syscall !== 'listen') { + throw error; + } + + var bind = typeof port === 'string' + ? 'Pipe ' + port + : 'Port ' + port; + + // handle specific listen errors with friendly messages + switch (error.code) { + case 'EACCES': + console.error(bind + ' requires elevated privileges'); + process.exit(1); + break; + case 'EADDRINUSE': + console.error(bind + ' is already in use'); + process.exit(1); + break; + default: + throw error; + } +} + +/** + * Event listener for HTTP server "listening" event. + */ + +function onListening() { + var addr = server.address(); + var bind = typeof addr === 'string' + ? 'pipe ' + addr + : 'port ' + addr.port; + debug('Listening on ' + bind); +} diff --git a/minverse/.editorconfig b/minverse/.editorconfig deleted file mode 100644 index 9142239..0000000 --- a/minverse/.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -# editorconfig.org -root = true - -[*] -indent_size = 2 -indent_style = space -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false diff --git a/minverse/.env.example b/minverse/.env.example deleted file mode 100644 index 6a2fb47..0000000 --- a/minverse/.env.example +++ /dev/null @@ -1,18 +0,0 @@ -HOST=127.0.0.1 -PORT=3333 -NODE_ENV=development -APP_URL=http://${HOST}:${PORT} - -CACHE_VIEWS=false - -APP_KEY= - -DB_CONNECTION=sqlite -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_USER=root -DB_PASSWORD= -DB_DATABASE=adonis - -SESSION_DRIVER=cookie -HASH_DRIVER=bcrypt diff --git a/minverse/.gitignore b/minverse/.gitignore deleted file mode 100644 index 585b363..0000000 --- a/minverse/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# Node modules -node_modules -package-lock.json - -# Adonis directory for storing tmp files -tmp - -# Environment variables, never commit this file -.env - -# The development sqlite file -database/*.sqlite - -# VSCode & Webstorm history directories -.history -.idea diff --git a/minverse/README.md b/minverse/README.md deleted file mode 100644 index d78d10e..0000000 --- a/minverse/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Adonis fullstack application - -This is the fullstack boilerplate for AdonisJs, it comes pre-configured with. - -1. Bodyparser -2. Session -3. Authentication -4. Web security middleware -5. CORS -6. Edge template engine -7. Lucid ORM -8. Migrations and seeds - -## Setup - -Use the adonis command to install the blueprint - -```bash -adonis new yardstick -``` - -or manually clone the repo and then run `npm install`. - - -### Migrations - -Run the following command to run startup migrations. - -```js -adonis migration:run -``` diff --git a/minverse/ace b/minverse/ace deleted file mode 100644 index 271a604..0000000 --- a/minverse/ace +++ /dev/null @@ -1,21 +0,0 @@ -'use strict' - -/* -|-------------------------------------------------------------------------- -| Ace Commands -|-------------------------------------------------------------------------- -| -| The ace file is just a regular Javascript file but with no extension. You -| can call `node ace` followed by the command name and it just works. -| -| Also you can use `adonis` followed by the command name, since the adonis -| global proxy all the ace commands. -| -*/ - -const { Ignitor } = require('@adonisjs/ignitor') - -new Ignitor(require('@adonisjs/fold')) - .appRoot(__dirname) - .fireAce() - .catch(console.error) diff --git a/minverse/app/Middleware/ConvertEmptyStringsToNull.js b/minverse/app/Middleware/ConvertEmptyStringsToNull.js deleted file mode 100644 index a5750cc..0000000 --- a/minverse/app/Middleware/ConvertEmptyStringsToNull.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -class ConvertEmptyStringsToNull { - async handle ({ request }, next) { - if (Object.keys(request.body).length) { - request.body = Object.assign( - ...Object.keys(request.body).map(key => ({ - [key]: request.body[key] !== '' ? request.body[key] : null - })) - ) - } - - await next() - } -} - -module.exports = ConvertEmptyStringsToNull diff --git a/minverse/app/Models/Token.js b/minverse/app/Models/Token.js deleted file mode 100644 index e089e87..0000000 --- a/minverse/app/Models/Token.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict' - -/** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */ -const Model = use('Model') - -class Token extends Model { -} - -module.exports = Token diff --git a/minverse/app/Models/Traits/NoTimestamp.js b/minverse/app/Models/Traits/NoTimestamp.js deleted file mode 100644 index 58c9340..0000000 --- a/minverse/app/Models/Traits/NoTimestamp.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict' - -class NoTimestamp { - register (Model) { - Object.defineProperties(Model, { - createdAtColumn: { - get: () => null, - }, - updatedAtColumn: { - get: () => null, - }, - }) - } -} - -module.exports = NoTimestamp diff --git a/minverse/app/Models/User.js b/minverse/app/Models/User.js deleted file mode 100644 index 2804a44..0000000 --- a/minverse/app/Models/User.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' - -/** @type {import('@adonisjs/framework/src/Hash')} */ -const Hash = use('Hash') - -/** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */ -const Model = use('Model') - -class User extends Model { - static boot () { - super.boot() - - /** - * A hook to hash the user password before saving - * it to the database. - */ - this.addHook('beforeSave', async (userInstance) => { - if (userInstance.dirty.password) { - userInstance.password = await Hash.make(userInstance.password) - } - }) - } - - /** - * A relationship on tokens is required for auth to - * work. Since features like `refreshTokens` or - * `rememberToken` will be saved inside the - * tokens table. - * - * @method tokens - * - * @return {Object} - */ - tokens () { - return this.hasMany('App/Models/Token') - } -} - -module.exports = User diff --git a/minverse/config/app.js b/minverse/config/app.js deleted file mode 100644 index 42c63a3..0000000 --- a/minverse/config/app.js +++ /dev/null @@ -1,243 +0,0 @@ -'use strict' - -/** @type {import('@adonisjs/framework/src/Env')} */ -const Env = use('Env') - -module.exports = { - - /* - |-------------------------------------------------------------------------- - | Application Name - |-------------------------------------------------------------------------- - | - | This value is the name of your application and can be used when you - | need to place the application's name in a email, view or - | other location. - | - */ - - name: Env.get('APP_NAME', 'AdonisJs'), - - /* - |-------------------------------------------------------------------------- - | App Key - |-------------------------------------------------------------------------- - | - | App key is a randomly generated 16 or 32 characters long string required - | to encrypted cookies, sessions and other sensitive data. - | - */ - appKey: Env.getOrFail('APP_KEY'), - - http: { - /* - |-------------------------------------------------------------------------- - | Allow Method Spoofing - |-------------------------------------------------------------------------- - | - | Method spoofing allows you to make requests by spoofing the http verb. - | Which means you can make a GET request but instruct the server to - | treat as a POST or PUT request. If you want this feature, set the - | below value to true. - | - */ - allowMethodSpoofing: true, - - /* - |-------------------------------------------------------------------------- - | Trust Proxy - |-------------------------------------------------------------------------- - | - | Trust proxy defines whether X-Forwarded-* headers should be trusted or not. - | When your application is behind a proxy server like nginx, these values - | are set automatically and should be trusted. Apart from setting it - | to true or false Adonis supports a handful of ways to allow proxy - | values. Read documentation for that. - | - */ - trustProxy: false, - - /* - |-------------------------------------------------------------------------- - | Subdomains - |-------------------------------------------------------------------------- - | - | Offset to be used for returning subdomains for a given request. For - | majority of applications it will be 2, until you have nested - | sudomains. - | cheatsheet.adonisjs.com - offset - 2 - | virk.cheatsheet.adonisjs.com - offset - 3 - | - */ - subdomainOffset: 2, - - /* - |-------------------------------------------------------------------------- - | JSONP Callback - |-------------------------------------------------------------------------- - | - | Default jsonp callback to be used when callback query string is missing - | in request url. - | - */ - jsonpCallback: 'callback', - - - /* - |-------------------------------------------------------------------------- - | Etag - |-------------------------------------------------------------------------- - | - | Set etag on all HTTP responses. In order to disable for selected routes, - | you can call the `response.send` with an options object as follows. - | - | response.send('Hello', { ignoreEtag: true }) - | - */ - etag: false - }, - - views: { - /* - |-------------------------------------------------------------------------- - | Cache Views - |-------------------------------------------------------------------------- - | - | Define whether or not to cache the compiled view. Set it to true in - | production to optimize view loading time. - | - */ - cache: Env.get('CACHE_VIEWS', true) - }, - - static: { - /* - |-------------------------------------------------------------------------- - | Dot Files - |-------------------------------------------------------------------------- - | - | Define how to treat dot files when trying to serve static resources. - | By default it is set to ignore, which will pretend that dotfiles - | do not exist. - | - | Can be one of the following - | ignore, deny, allow - | - */ - dotfiles: 'ignore', - - /* - |-------------------------------------------------------------------------- - | ETag - |-------------------------------------------------------------------------- - | - | Enable or disable etag generation - | - */ - etag: true, - - /* - |-------------------------------------------------------------------------- - | Extensions - |-------------------------------------------------------------------------- - | - | Set file extension fallbacks. When set, if a file is not found, the given - | extensions will be added to the file name and search for. The first - | that exists will be served. Example: ['html', 'htm']. - | - */ - extensions: false - }, - - locales: { - /* - |-------------------------------------------------------------------------- - | Loader - |-------------------------------------------------------------------------- - | - | The loader to be used for fetching and updating locales. Below is the - | list of available options. - | - | file, database - | - */ - loader: 'file', - - /* - |-------------------------------------------------------------------------- - | Default Locale - |-------------------------------------------------------------------------- - | - | Default locale to be used by Antl provider. You can always switch drivers - | in runtime or use the official Antl middleware to detect the driver - | based on HTTP headers/query string. - | - */ - locale: 'en' - }, - - logger: { - /* - |-------------------------------------------------------------------------- - | Transport - |-------------------------------------------------------------------------- - | - | Transport to be used for logging messages. You can have multiple - | transports using same driver. - | - | Available drivers are: `file` and `console`. - | - */ - transport: 'console', - - /* - |-------------------------------------------------------------------------- - | Console Transport - |-------------------------------------------------------------------------- - | - | Using `console` driver for logging. This driver writes to `stdout` - | and `stderr` - | - */ - console: { - driver: 'console', - name: 'adonis-app', - level: 'info' - }, - - /* - |-------------------------------------------------------------------------- - | File Transport - |-------------------------------------------------------------------------- - | - | File transport uses file driver and writes log messages for a given - | file inside `tmp` directory for your app. - | - | For a different directory, set an absolute path for the filename. - | - */ - file: { - driver: 'file', - name: 'adonis-app', - filename: 'adonis.log', - level: 'info' - } - }, - - /* - |-------------------------------------------------------------------------- - | Generic Cookie Options - |-------------------------------------------------------------------------- - | - | The following cookie options are generic settings used by AdonisJs to create - | cookies. However, some parts of the application like `sessions` can have - | seperate settings for cookies inside `config/session.js`. - | - */ - cookie: { - httpOnly: true, - sameSite: false, - path: '/', - maxAge: 7200 - } -} diff --git a/minverse/config/auth.js b/minverse/config/auth.js deleted file mode 100644 index 5fceb35..0000000 --- a/minverse/config/auth.js +++ /dev/null @@ -1,94 +0,0 @@ -'use strict' - -/** @type {import('@adonisjs/framework/src/Env')} */ -const Env = use('Env') - -module.exports = { - /* - |-------------------------------------------------------------------------- - | Authenticator - |-------------------------------------------------------------------------- - | - | Authentication is a combination of serializer and scheme with extra - | config to define on how to authenticate a user. - | - | Available Schemes - basic, session, jwt, api - | Available Serializers - lucid, database - | - */ - authenticator: 'session', - - /* - |-------------------------------------------------------------------------- - | Session - |-------------------------------------------------------------------------- - | - | Session authenticator makes use of sessions to authenticate a user. - | Session authentication is always persistent. - | - */ - session: { - serializer: 'lucid', - model: 'App/Models/User', - scheme: 'session', - uid: 'email', - password: 'password' - }, - - /* - |-------------------------------------------------------------------------- - | Basic Auth - |-------------------------------------------------------------------------- - | - | The basic auth authenticator uses basic auth header to authenticate a - | user. - | - | NOTE: - | This scheme is not persistent and users are supposed to pass - | login credentials on each request. - | - */ - basic: { - serializer: 'lucid', - model: 'App/Models/User', - scheme: 'basic', - uid: 'email', - password: 'password' - }, - - /* - |-------------------------------------------------------------------------- - | Jwt - |-------------------------------------------------------------------------- - | - | The jwt authenticator works by passing a jwt token on each HTTP request - | via HTTP `Authorization` header. - | - */ - jwt: { - serializer: 'lucid', - model: 'App/Models/User', - scheme: 'jwt', - uid: 'email', - password: 'password', - options: { - secret: Env.get('APP_KEY') - } - }, - - /* - |-------------------------------------------------------------------------- - | Api - |-------------------------------------------------------------------------- - | - | The Api scheme makes use of API personal tokens to authenticate a user. - | - */ - api: { - serializer: 'lucid', - model: 'App/Models/User', - scheme: 'api', - uid: 'email', - password: 'password' - } -} diff --git a/minverse/config/bodyParser.js b/minverse/config/bodyParser.js deleted file mode 100644 index 6b40f1a..0000000 --- a/minverse/config/bodyParser.js +++ /dev/null @@ -1,157 +0,0 @@ -'use strict' - -module.exports = { - /* - |-------------------------------------------------------------------------- - | JSON Parser - |-------------------------------------------------------------------------- - | - | Below settings are applied when request body contains JSON payload. If - | you want body parser to ignore JSON payload, then simply set `types` - | to an empty array. - */ - json: { - /* - |-------------------------------------------------------------------------- - | limit - |-------------------------------------------------------------------------- - | - | Defines the limit of JSON that can be sent by the client. If payload - | is over 1mb it will not be processed. - | - */ - limit: '1mb', - - /* - |-------------------------------------------------------------------------- - | strict - |-------------------------------------------------------------------------- - | - | When `scrict` is set to true, body parser will only parse Arrays and - | Object. Otherwise everything parseable by `JSON.parse` is parsed. - | - */ - strict: true, - - /* - |-------------------------------------------------------------------------- - | types - |-------------------------------------------------------------------------- - | - | Which content types are processed as JSON payloads. You are free to - | add your own types here, but the request body should be parseable - | by `JSON.parse` method. - | - */ - types: [ - 'application/json', - 'application/json-patch+json', - 'application/vnd.api+json', - 'application/csp-report' - ] - }, - - /* - |-------------------------------------------------------------------------- - | Raw Parser - |-------------------------------------------------------------------------- - | - | - | - */ - raw: { - types: [ - 'text/*' - ] - }, - - /* - |-------------------------------------------------------------------------- - | Form Parser - |-------------------------------------------------------------------------- - | - | - | - */ - form: { - types: [ - 'application/x-www-form-urlencoded' - ] - }, - - /* - |-------------------------------------------------------------------------- - | Files Parser - |-------------------------------------------------------------------------- - | - | - | - */ - files: { - types: [ - 'multipart/form-data' - ], - - /* - |-------------------------------------------------------------------------- - | Max Size - |-------------------------------------------------------------------------- - | - | Below value is the max size of all the files uploaded to the server. It - | is validated even before files have been processed and hard exception - | is thrown. - | - | Consider setting a reasonable value here, otherwise people may upload GB's - | of files which will keep your server busy. - | - | Also this value is considered when `autoProcess` is set to true. - | - */ - maxSize: '20mb', - - /* - |-------------------------------------------------------------------------- - | Auto Process - |-------------------------------------------------------------------------- - | - | Whether or not to auto-process files. Since HTTP servers handle files via - | couple of specific endpoints. It is better to set this value off and - | manually process the files when required. - | - | This value can contain a boolean or an array of route patterns - | to be autoprocessed. - */ - autoProcess: true, - - /* - |-------------------------------------------------------------------------- - | Process Manually - |-------------------------------------------------------------------------- - | - | The list of routes that should not process files and instead rely on - | manual process. This list should only contain routes when autoProcess - | is to true. Otherwise everything is processed manually. - | - */ - processManually: [] - - /* - |-------------------------------------------------------------------------- - | Temporary file name - |-------------------------------------------------------------------------- - | - | Define a function, which should return a string to be used as the - | tmp file name. - | - | If not defined, Bodyparser will use `uuid` as the tmp file name. - | - | To be defined as. If you are defining the function, then do make sure - | to return a value from it. - | - | tmpFileName () { - | return 'some-unique-value' - | } - | - */ - } -} diff --git a/minverse/config/cors.js b/minverse/config/cors.js deleted file mode 100644 index 4c3848e..0000000 --- a/minverse/config/cors.js +++ /dev/null @@ -1,87 +0,0 @@ -'use strict' - -module.exports = { - /* - |-------------------------------------------------------------------------- - | Origin - |-------------------------------------------------------------------------- - | - | Set a list of origins to be allowed. The value can be one of the following - | - | Boolean: true - Allow current request origin - | Boolean: false - Disallow all - | String - Comma seperated list of allowed origins - | Array - An array of allowed origins - | String: * - A wildcard to allow current request origin - | Function - Receives the current origin and should return one of the above values. - | - */ - origin: false, - - /* - |-------------------------------------------------------------------------- - | Methods - |-------------------------------------------------------------------------- - | - | HTTP methods to be allowed. The value can be one of the following - | - | String - Comma seperated list of allowed methods - | Array - An array of allowed methods - | - */ - methods: ['GET', 'PUT', 'PATCH', 'POST', 'DELETE'], - - /* - |-------------------------------------------------------------------------- - | Headers - |-------------------------------------------------------------------------- - | - | List of headers to be allowed via Access-Control-Request-Headers header. - | The value can be on of the following. - | - | Boolean: true - Allow current request headers - | Boolean: false - Disallow all - | String - Comma seperated list of allowed headers - | Array - An array of allowed headers - | String: * - A wildcard to allow current request headers - | Function - Receives the current header and should return one of the above values. - | - */ - headers: true, - - /* - |-------------------------------------------------------------------------- - | Expose Headers - |-------------------------------------------------------------------------- - | - | A list of headers to be exposed via `Access-Control-Expose-Headers` - | header. The value can be on of the following. - | - | Boolean: false - Disallow all - | String: Comma seperated list of allowed headers - | Array - An array of allowed headers - | - */ - exposeHeaders: false, - - /* - |-------------------------------------------------------------------------- - | Credentials - |-------------------------------------------------------------------------- - | - | Define Access-Control-Allow-Credentials header. It should always be a - | boolean. - | - */ - credentials: false, - - /* - |-------------------------------------------------------------------------- - | MaxAge - |-------------------------------------------------------------------------- - | - | Define Access-Control-Allow-Max-Age - | - */ - maxAge: 90 -} diff --git a/minverse/config/database.js b/minverse/config/database.js deleted file mode 100644 index e9cb916..0000000 --- a/minverse/config/database.js +++ /dev/null @@ -1,81 +0,0 @@ -'use strict' - -/** @type {import('@adonisjs/framework/src/Env')} */ -const Env = use('Env') - -/** @type {import('@adonisjs/ignitor/src/Helpers')} */ -const Helpers = use('Helpers') - -module.exports = { - /* - |-------------------------------------------------------------------------- - | Default Connection - |-------------------------------------------------------------------------- - | - | Connection defines the default connection settings to be used while - | interacting with SQL databases. - | - */ - connection: Env.get('DB_CONNECTION', 'sqlite'), - - /* - |-------------------------------------------------------------------------- - | Sqlite - |-------------------------------------------------------------------------- - | - | Sqlite is a flat file database and can be good choice under development - | environment. - | - | npm i --save sqlite3 - | - */ - sqlite: { - client: 'sqlite3', - connection: { - filename: Helpers.databasePath(`${Env.get('DB_DATABASE', 'development')}.sqlite`) - }, - useNullAsDefault: true - }, - - /* - |-------------------------------------------------------------------------- - | MySQL - |-------------------------------------------------------------------------- - | - | Here we define connection settings for MySQL database. - | - | npm i --save mysql - | - */ - mysql: { - client: 'mysql', - connection: { - host: Env.get('DB_HOST', 'localhost'), - port: Env.get('DB_PORT', ''), - user: Env.get('DB_USER', 'root'), - password: Env.get('DB_PASSWORD', ''), - database: Env.get('DB_DATABASE', 'adonis') - } - }, - - /* - |-------------------------------------------------------------------------- - | PostgreSQL - |-------------------------------------------------------------------------- - | - | Here we define connection settings for PostgreSQL database. - | - | npm i --save pg - | - */ - pg: { - client: 'pg', - connection: { - host: Env.get('DB_HOST', 'localhost'), - port: Env.get('DB_PORT', ''), - user: Env.get('DB_USER', 'root'), - password: Env.get('DB_PASSWORD', ''), - database: Env.get('DB_DATABASE', 'adonis') - } - } -} diff --git a/minverse/config/hash.js b/minverse/config/hash.js deleted file mode 100644 index 42f5805..0000000 --- a/minverse/config/hash.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict' - -/** @type {import('@adonisjs/framework/src/Env')} */ -const Env = use('Env') - -module.exports = { - /* - |-------------------------------------------------------------------------- - | Driver - |-------------------------------------------------------------------------- - | - | Driver to be used for hashing values. The same driver is used by the - | auth module too. - | - */ - driver: Env.get('HASH_DRIVER', 'bcrypt'), - - /* - |-------------------------------------------------------------------------- - | Bcrypt - |-------------------------------------------------------------------------- - | - | Config related to bcrypt hashing. https://www.npmjs.com/package/bcrypt - | package is used internally. - | - */ - bcrypt: { - rounds: 10 - }, - - /* - |-------------------------------------------------------------------------- - | Argon - |-------------------------------------------------------------------------- - | - | Config related to argon. https://www.npmjs.com/package/argon2 package is - | used internally. - | - | Since argon is optional, you will have to install the dependency yourself - | - |============================================================================ - | npm i argon2 - |============================================================================ - | - */ - argon: { - type: 1 - } -} diff --git a/minverse/config/session.js b/minverse/config/session.js deleted file mode 100644 index 30d6bab..0000000 --- a/minverse/config/session.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict' - -/** @type {import('@adonisjs/framework/src/Env')} */ -const Env = use('Env') - -module.exports = { - /* - |-------------------------------------------------------------------------- - | Session Driver - |-------------------------------------------------------------------------- - | - | The session driver to be used for storing session values. It can be - | cookie, file or redis. - | - | For `redis` driver, make sure to install and register `@adonisjs/redis` - | - */ - driver: Env.get('SESSION_DRIVER', 'cookie'), - - /* - |-------------------------------------------------------------------------- - | Cookie Name - |-------------------------------------------------------------------------- - | - | The name of the cookie to be used for saving session id. Session ids - | are signed and encrypted. - | - */ - cookieName: 'adonis-session', - - /* - |-------------------------------------------------------------------------- - | Clear session when browser closes - |-------------------------------------------------------------------------- - | - | If this value is true, the session cookie will be temporary and will be - | removed when browser closes. - | - */ - clearWithBrowser: true, - - /* - |-------------------------------------------------------------------------- - | Session age - |-------------------------------------------------------------------------- - | - | This value is only used when `clearWithBrowser` is set to false. The - | age must be a valid https://npmjs.org/package/ms string or should - | be in milliseconds. - | - | Valid values are: - | '2h', '10d', '5y', '2.5 hrs' - | - */ - age: '2h', - - /* - |-------------------------------------------------------------------------- - | Cookie options - |-------------------------------------------------------------------------- - | - | Cookie options defines the options to be used for setting up session - | cookie - | - */ - cookie: { - httpOnly: true, - sameSite: false, - path: '/' - }, - - /* - |-------------------------------------------------------------------------- - | Sessions location - |-------------------------------------------------------------------------- - | - | If driver is set to file, we need to define the relative location from - | the temporary path or absolute url to any location. - | - */ - file: { - location: 'sessions' - }, - - /* - |-------------------------------------------------------------------------- - | Redis config - |-------------------------------------------------------------------------- - | - | The configuration for the redis driver. By default we reference it from - | the redis file. But you are free to define an object here too. - | - */ - redis: { - host: '127.0.0.1', - port: 6379, - password: null, - db: 0, - keyPrefix: '' - } -} diff --git a/minverse/config/shield.js b/minverse/config/shield.js deleted file mode 100644 index 255cee3..0000000 --- a/minverse/config/shield.js +++ /dev/null @@ -1,145 +0,0 @@ -'use strict' - -module.exports = { - /* - |-------------------------------------------------------------------------- - | Content Security Policy - |-------------------------------------------------------------------------- - | - | Content security policy filters out the origins not allowed to execute - | and load resources like scripts, styles and fonts. There are wide - | variety of options to choose from. - */ - csp: { - /* - |-------------------------------------------------------------------------- - | Directives - |-------------------------------------------------------------------------- - | - | All directives are defined in camelCase and here is the list of - | available directives and their possible values. - | - | https://content-security-policy.com - | - | @example - | directives: { - | defaultSrc: ['self', '@nonce', 'cdnjs.cloudflare.com'] - | } - | - */ - directives: { - }, - /* - |-------------------------------------------------------------------------- - | Report only - |-------------------------------------------------------------------------- - | - | Setting `reportOnly=true` will not block the scripts from running and - | instead report them to a URL. - | - */ - reportOnly: false, - /* - |-------------------------------------------------------------------------- - | Set all headers - |-------------------------------------------------------------------------- - | - | Headers staring with `X` have been depreciated, since all major browsers - | supports the standard CSP header. So its better to disable deperciated - | headers, unless you want them to be set. - | - */ - setAllHeaders: false, - - /* - |-------------------------------------------------------------------------- - | Disable on android - |-------------------------------------------------------------------------- - | - | Certain versions of android are buggy with CSP policy. So you can set - | this value to true, to disable it for Android versions with buggy - | behavior. - | - | Here is an issue reported on a different package, but helpful to read - | if you want to know the behavior. https://github.com/helmetjs/helmet/pull/82 - | - */ - disableAndroid: true - }, - - /* - |-------------------------------------------------------------------------- - | X-XSS-Protection - |-------------------------------------------------------------------------- - | - | X-XSS Protection saves applications from XSS attacks. It is adopted - | by IE and later followed by some other browsers. - | - | Learn more at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection - | - */ - xss: { - enabled: true, - enableOnOldIE: false - }, - - /* - |-------------------------------------------------------------------------- - | Iframe Options - |-------------------------------------------------------------------------- - | - | xframe defines whether or not your website can be embedded inside an - | iframe. Choose from one of the following options. - | @available options - | DENY, SAMEORIGIN, ALLOW-FROM http://example.com - | - | Learn more at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options - */ - xframe: 'DENY', - - /* - |-------------------------------------------------------------------------- - | No Sniff - |-------------------------------------------------------------------------- - | - | Browsers have a habit of sniffing content-type of a response. Which means - | files with .txt extension containing Javascript code will be executed as - | Javascript. You can disable this behavior by setting nosniff to false. - | - | Learn more at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options - | - */ - nosniff: true, - - /* - |-------------------------------------------------------------------------- - | No Open - |-------------------------------------------------------------------------- - | - | IE users can execute webpages in the context of your website, which is - | a serious security risk. Below option will manage this for you. - | - */ - noopen: true, - - /* - |-------------------------------------------------------------------------- - | CSRF Protection - |-------------------------------------------------------------------------- - | - | CSRF Protection adds another layer of security by making sure, actionable - | routes does have a valid token to execute an action. - | - */ - csrf: { - enable: true, - methods: ['POST', 'PUT', 'DELETE'], - filterUris: [], - cookieOptions: { - httpOnly: false, - sameSite: true, - path: '/', - maxAge: 7200 - } - } -} diff --git a/minverse/database/factory.js b/minverse/database/factory.js deleted file mode 100644 index 16b5084..0000000 --- a/minverse/database/factory.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict' - -/* -|-------------------------------------------------------------------------- -| Factory -|-------------------------------------------------------------------------- -| -| Factories are used to define blueprints for database tables or Lucid -| models. Later you can use these blueprints to seed your database -| with dummy data. -| -*/ - -/** @type {import('@adonisjs/lucid/src/Factory')} */ -// const Factory = use('Factory') - -// Factory.blueprint('App/Models/User', (faker) => { -// return { -// username: faker.username() -// } -// }) diff --git a/minverse/database/migrations/1503248427885_user.js b/minverse/database/migrations/1503248427885_user.js deleted file mode 100644 index 1ade2f5..0000000 --- a/minverse/database/migrations/1503248427885_user.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict' - -/** @type {import('@adonisjs/lucid/src/Schema')} */ -const Schema = use('Schema') - -class UserSchema extends Schema { - up () { - this.create('users', (table) => { - table.increments() - table.string('username', 80).notNullable().unique() - table.string('email', 254).notNullable().unique() - table.string('password', 60).notNullable() - table.timestamps() - }) - } - - down () { - this.drop('users') - } -} - -module.exports = UserSchema diff --git a/minverse/database/migrations/1503248427886_token.js b/minverse/database/migrations/1503248427886_token.js deleted file mode 100644 index c8bb9fc..0000000 --- a/minverse/database/migrations/1503248427886_token.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -/** @type {import('@adonisjs/lucid/src/Schema')} */ -const Schema = use('Schema') - -class TokensSchema extends Schema { - up () { - this.create('tokens', (table) => { - table.increments() - table.integer('user_id').unsigned().references('id').inTable('users') - table.string('token', 255).notNullable().unique().index() - table.string('type', 80).notNullable() - table.boolean('is_revoked').defaultTo(false) - table.timestamps() - }) - } - - down () { - this.drop('tokens') - } -} - -module.exports = TokensSchema diff --git a/minverse/package.json b/minverse/package.json deleted file mode 100644 index 00f6deb..0000000 --- a/minverse/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "adonis-fullstack-app", - "version": "4.1.0", - "adonis-version": "4.1.0", - "description": "The fullstack application boilerplate for Adonisjs", - "main": "index.js", - "scripts": { - "start": "node server.js", - "test": "node ace test" - }, - "keywords": [ - "adonisjs", - "adonis-app" - ], - "author": "", - "license": "UNLICENSED", - "private": true, - "dependencies": { - "@adonisjs/ace": "^5.0.8", - "@adonisjs/auth": "^3.0.7", - "@adonisjs/bodyparser": "^2.0.5", - "@adonisjs/cors": "^1.0.7", - "@adonisjs/fold": "^4.0.9", - "@adonisjs/framework": "^5.0.9", - "@adonisjs/ignitor": "^2.0.8", - "@adonisjs/lucid": "^6.1.3", - "@adonisjs/session": "^1.0.27", - "@adonisjs/shield": "^1.0.8" - }, - "devDependencies": {}, - "autoload": { - "App": "./app" - } -} diff --git a/minverse/public/logo.svg b/minverse/public/logo.svg deleted file mode 100644 index c8be274..0000000 --- a/minverse/public/logo.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/minverse/public/pyramid.png b/minverse/public/pyramid.png deleted file mode 100644 index 369ab18..0000000 Binary files a/minverse/public/pyramid.png and /dev/null differ diff --git a/minverse/public/splash.png b/minverse/public/splash.png deleted file mode 100644 index 7ea4fe0..0000000 Binary files a/minverse/public/splash.png and /dev/null differ diff --git a/minverse/public/style.css b/minverse/public/style.css deleted file mode 100644 index c805815..0000000 --- a/minverse/public/style.css +++ /dev/null @@ -1,92 +0,0 @@ -@import url('https://fonts.googleapis.com/css?family=Montserrat:300'); - -html, body { - height: 100%; - width: 100%; -} - -body { - font-family: 'Montserrat', sans-serif; - font-weight: 300; - background-image: url("/splash.png"); - background-color: #220052; -} - -* { - margin: 0; - padding: 0; -} - -section { - height: 100%; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - max-width: 536px; - margin: auto; - position: relative; -} - -section:before { - content: ""; - position: absolute; - background: url("/pyramid.png") no-repeat; - background-size: 100%; - width: 100%; - height: 402px; - z-index: -1; -} - -.logo { - background: url("/logo.svg") no-repeat; - width: 36px; - height: 33px; - background-size: 100%; - margin-bottom: 35px; - opacity: 0; - animation: slideUp 1s cubic-bezier(0.19, 1, 0.30, 1) 1.3s forwards; -} - -.title { - background: url("/title.svg") no-repeat; - width: 219px; - height: 36px; - background-size: 100%; - opacity: 0; - animation: slideUp 1s cubic-bezier(0.19, 1, 0.30, 1) 0.2s forwards; -} - -.subtitle { - margin-top: 25px; - color: #BDB3CB; - font-size: 17px; - text-align: center; - letter-spacing: 0.5; - opacity: 0; - animation: slideUp 1s cubic-bezier(0.19, 1, 0.30, 1) 0.5s forwards; -} - - -a { - color: inherit; - text-decoration: underline; -} - -p { - margin: 0.83rem 0; -} - -@keyframes slideUp { - 0% { - transform: translateY(40px); - opacity: 0; - } - 50% { - opacity: 0.2%; - } - 100% { - opacity: 1; - transform: none; - } -} diff --git a/minverse/public/title.svg b/minverse/public/title.svg deleted file mode 100644 index 38dea69..0000000 --- a/minverse/public/title.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/minverse/resources/views/welcome.edge b/minverse/resources/views/welcome.edge deleted file mode 100644 index 4355627..0000000 --- a/minverse/resources/views/welcome.edge +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Hello Adonis - {{ style('style') }} - - -
- -
-
-

AdonisJs simplicity will make you feel confident about your code

-

- Don't know where to start? Read the documentation. -

-
-
- - diff --git a/minverse/server.js b/minverse/server.js deleted file mode 100644 index c3a987b..0000000 --- a/minverse/server.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict' - -/* -|-------------------------------------------------------------------------- -| Http server -|-------------------------------------------------------------------------- -| -| This file bootstrap Adonisjs to start the HTTP server. You are free to -| customize the process of booting the http server. -| -| """ Loading ace commands """ -| At times you may want to load ace commands when starting the HTTP server. -| Same can be done by chaining `loadCommands()` method after -| -| """ Preloading files """ -| Also you can preload files by calling `preLoad('path/to/file')` method. -| Make sure to pass relative path from the project root. -*/ - -const { Ignitor } = require('@adonisjs/ignitor') - -new Ignitor(require('@adonisjs/fold')) - .appRoot(__dirname) - .fireHttpServer() - .catch(console.error) diff --git a/minverse/start/app.js b/minverse/start/app.js deleted file mode 100644 index e42f331..0000000 --- a/minverse/start/app.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict' - -/* -|-------------------------------------------------------------------------- -| Providers -|-------------------------------------------------------------------------- -| -| Providers are building blocks for your Adonis app. Anytime you install -| a new Adonis specific package, chances are you will register the -| provider here. -| -*/ -const providers = [ - '@adonisjs/framework/providers/AppProvider', - '@adonisjs/framework/providers/ViewProvider', - '@adonisjs/lucid/providers/LucidProvider', - '@adonisjs/bodyparser/providers/BodyParserProvider', - '@adonisjs/cors/providers/CorsProvider', - '@adonisjs/shield/providers/ShieldProvider', - '@adonisjs/session/providers/SessionProvider', - '@adonisjs/auth/providers/AuthProvider' -] - -/* -|-------------------------------------------------------------------------- -| Ace Providers -|-------------------------------------------------------------------------- -| -| Ace providers are required only when running ace commands. For example -| Providers for migrations, tests etc. -| -*/ -const aceProviders = [ - '@adonisjs/lucid/providers/MigrationsProvider' -] - -/* -|-------------------------------------------------------------------------- -| Aliases -|-------------------------------------------------------------------------- -| -| Aliases are short unique names for IoC container bindings. You are free -| to create your own aliases. -| -| For example: -| { Route: 'Adonis/Src/Route' } -| -*/ -const aliases = {} - -/* -|-------------------------------------------------------------------------- -| Commands -|-------------------------------------------------------------------------- -| -| Here you store ace commands for your package -| -*/ -const commands = [] - -module.exports = { providers, aceProviders, aliases, commands } diff --git a/minverse/start/kernel.js b/minverse/start/kernel.js deleted file mode 100644 index b4f2720..0000000 --- a/minverse/start/kernel.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict' - -/** @type {import('@adonisjs/framework/src/Server')} */ -const Server = use('Server') - -/* -|-------------------------------------------------------------------------- -| Global Middleware -|-------------------------------------------------------------------------- -| -| Global middleware are executed on each http request only when the routes -| match. -| -*/ -const globalMiddleware = [ - 'Adonis/Middleware/BodyParser', - 'Adonis/Middleware/Session', - 'Adonis/Middleware/Shield', - 'Adonis/Middleware/AuthInit', - 'App/Middleware/ConvertEmptyStringsToNull', -] - -/* -|-------------------------------------------------------------------------- -| Named Middleware -|-------------------------------------------------------------------------- -| -| Named middleware is key/value object to conditionally add middleware on -| specific routes or group of routes. -| -| // define -| { -| auth: 'Adonis/Middleware/Auth' -| } -| -| // use -| Route.get().middleware('auth') -| -*/ -const namedMiddleware = { - auth: 'Adonis/Middleware/Auth', - guest: 'Adonis/Middleware/AllowGuestOnly' -} - -/* -|-------------------------------------------------------------------------- -| Server Middleware -|-------------------------------------------------------------------------- -| -| Server level middleware are executed even when route for a given URL is -| not registered. Features like `static assets` and `cors` needs better -| control over request lifecycle. -| -*/ -const serverMiddleware = [ - 'Adonis/Middleware/Static', - 'Adonis/Middleware/Cors' -] - -Server - .registerGlobal(globalMiddleware) - .registerNamed(namedMiddleware) - .use(serverMiddleware) diff --git a/minverse/start/routes.js b/minverse/start/routes.js deleted file mode 100644 index 2c057eb..0000000 --- a/minverse/start/routes.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict' - -/* -|-------------------------------------------------------------------------- -| Routes -|-------------------------------------------------------------------------- -| -| Http routes are entry points to your web application. You can create -| routes for different URL's and bind Controller actions to them. -| -| A complete guide on routing is available here. -| http://adonisjs.com/docs/4.1/routing -| -*/ - -/** @type {typeof import('@adonisjs/framework/src/Route/Manager')} */ -const Route = use('Route') - -Route.on('/').render('welcome') diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..367d9db --- /dev/null +++ b/package-lock.json @@ -0,0 +1,455 @@ +{ + "name": "australia", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "requires": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "requires": { + "safe-buffer": "5.1.2" + } + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-parser": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.4.tgz", + "integrity": "sha512-lo13tqF3JEtFO7FyA49CqbhaFkskRJ0u/UAiINgrIXeRCY41c88/zxtrECl8AKH3B0hj9q10+h3Kt8I7KlW4tw==", + "requires": { + "cookie": "0.3.1", + "cookie-signature": "1.0.6" + } + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + } + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + } + }, + "foreachasync": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/foreachasync/-/foreachasync-3.0.0.tgz", + "integrity": "sha1-VQKYfchxS+M5IJfzLgBxyd7gfPY=" + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", + "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==" + }, + "locutus": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/locutus/-/locutus-2.0.11.tgz", + "integrity": "sha512-C0q1L38lK5q1t+wE0KY21/9szrBHxye6o2z5EJzU+5B79tubNOC+nLAEzTTn1vPUGoUuehKh8kYKqiVUTWRyaQ==", + "requires": { + "es6-promise": "^4.2.5" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.42.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.42.0.tgz", + "integrity": "sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ==" + }, + "mime-types": { + "version": "2.1.25", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.25.tgz", + "integrity": "sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg==", + "requires": { + "mime-db": "1.42.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "morgan": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz", + "integrity": "sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA==", + "requires": { + "basic-auth": "~2.0.0", + "debug": "2.6.9", + "depd": "~1.1.2", + "on-finished": "~2.3.0", + "on-headers": "~1.0.1" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==" + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "proxy-addr": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", + "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.9.0" + } + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + }, + "twig": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/twig/-/twig-0.10.3.tgz", + "integrity": "sha1-Z2BOCOGSDr8vr4CpAeJWGJyKPGc=", + "requires": { + "locutus": "^2.0.5", + "minimatch": "3.0.x", + "walk": "2.3.x" + } + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "walk": { + "version": "2.3.14", + "resolved": "https://registry.npmjs.org/walk/-/walk-2.3.14.tgz", + "integrity": "sha512-5skcWAUmySj6hkBdH6B6+3ddMjVQYH5Qy9QGbPmN8kVmLteXk+yVXg+yfk1nbX30EYakahLrr8iPcCxJQSCBeg==", + "requires": { + "foreachasync": "^3.0.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..e33955d --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "australia", + "version": "0.0.0", + "private": true, + "scripts": { + "start": "node ./bin/www" + }, + "dependencies": { + "cookie-parser": "~1.4.4", + "debug": "~2.6.9", + "express": "~4.16.1", + "http-errors": "~1.6.3", + "morgan": "~1.9.1", + "twig": "~0.10.3" + } +} diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css new file mode 100644 index 0000000..9453385 --- /dev/null +++ b/public/stylesheets/style.css @@ -0,0 +1,8 @@ +body { + padding: 50px; + font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; +} + +a { + color: #00B7FF; +} diff --git a/routes/index.js b/routes/index.js new file mode 100644 index 0000000..ecca96a --- /dev/null +++ b/routes/index.js @@ -0,0 +1,9 @@ +var express = require('express'); +var router = express.Router(); + +/* GET home page. */ +router.get('/', function(req, res, next) { + res.render('index', { title: 'Express' }); +}); + +module.exports = router; diff --git a/routes/users.js b/routes/users.js new file mode 100644 index 0000000..623e430 --- /dev/null +++ b/routes/users.js @@ -0,0 +1,9 @@ +var express = require('express'); +var router = express.Router(); + +/* GET users listing. */ +router.get('/', function(req, res, next) { + res.send('respond with a resource'); +}); + +module.exports = router; diff --git a/views/error.twig b/views/error.twig new file mode 100644 index 0000000..caf7ce0 --- /dev/null +++ b/views/error.twig @@ -0,0 +1,7 @@ +{% extends 'layout.twig' %} + +{% block body %} +

{{message}}

+

{{error.status}}

+
{{error.stack}}
+{% endblock %} diff --git a/views/index.twig b/views/index.twig new file mode 100644 index 0000000..20372e3 --- /dev/null +++ b/views/index.twig @@ -0,0 +1,6 @@ +{% extends 'layout.twig' %} + +{% block body %} +

{{title}}

+

Welcome to {{title}}

+{% endblock %} diff --git a/views/layout.twig b/views/layout.twig new file mode 100644 index 0000000..bce6dd5 --- /dev/null +++ b/views/layout.twig @@ -0,0 +1,10 @@ + + + + {{ title }} + + + + {% block body %}{% endblock %} + +