Skip to content

Commit

Permalink
update codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
waghanza committed Jul 31, 2023
1 parent c6a16ba commit 228e8fc
Show file tree
Hide file tree
Showing 19 changed files with 199 additions and 175 deletions.
4 changes: 2 additions & 2 deletions d/cgi/dub.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "server",
"dependencies": {
"arsd-official:cgi": "~>10.9.10"
"arsd-official:cgi": "~>10.9.10"
},
"subConfigurations": {"arsd-official:cgi": "embedded_httpd_hybrid"},
"subConfigurations": { "arsd-official:cgi": "embedded_httpd_hybrid" },
"license": "MIT"
}
2 changes: 1 addition & 1 deletion d/handy/dub.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "server",
"dependencies": {
"handy-httpd": "~>7.1.0"
"handy-httpd": "~>7.1.0"
},
"license": "MIT"
}
2 changes: 1 addition & 1 deletion d/lighttp/dub.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "server",
"dependencies": {
"lighttp": "~>0.5.4"
"lighttp": "~>0.5.4"
},
"license": "MIT"
}
16 changes: 8 additions & 8 deletions d/lighttp/dub.selections.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"fileVersion": 1,
"versions": {
"libasync": "~master",
"lighttp": "0.5.4",
"memutils": "1.0.9",
"urld": "2.1.1",
"xbuffer": "1.0.0"
}
"fileVersion": 1,
"versions": {
"libasync": "~master",
"lighttp": "0.5.4",
"memutils": "1.0.9",
"urld": "2.1.1",
"xbuffer": "1.0.0"
}
}
2 changes: 1 addition & 1 deletion d/serverino/dub.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "server",
"dependencies": {
"serverino": "~>0.4.5"
"serverino": "~>0.4.5"
},
"license": "MIT"
}
51 changes: 26 additions & 25 deletions javascript/adonisjs/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/**
* @adonisjs/http-server
*
Expand All @@ -8,38 +7,40 @@
* file that was distributed with this source code.
*/

import proxyaddr from 'proxy-addr'
import { createServer } from 'http'
import { Encryption } from '@adonisjs/encryption/build/standalone'
import { Application } from '@adonisjs/application'
import { Server } from '@adonisjs/http-server/build/standalone'
import proxyaddr from "proxy-addr";
import { createServer } from "http";
import { Encryption } from "@adonisjs/encryption/build/standalone";
import { Application } from "@adonisjs/application";
import { Server } from "@adonisjs/http-server/build/standalone";

const app = new Application(__dirname, 'web', {})
app.setup()
const app = new Application(__dirname, "web", {});
app.setup();

const encryption = new Encryption({ secret: 'averylongrandom32charslongsecret' })
const encryption = new Encryption({
secret: "averylongrandom32charslongsecret",
});

const server = new Server(app, encryption, {
etag: false,
jsonpCallbackName: 'callback',
jsonpCallbackName: "callback",
cookie: {},
subdomainOffset: 2,
generateRequestId: false,
trustProxy: proxyaddr.compile('loopback'),
trustProxy: proxyaddr.compile("loopback"),
allowMethodSpoofing: false,
})
server.router.get('/', async () => {
return "";
})
server.router.post('/user', async () => {
return "";
})
server.router.get('/user/:id', async ({ params }) => {
return params.id;
})
server.optimize()
});

server.router.get("/", async () => {
return "";
});
server.router.post("/user", async () => {
return "";
});
server.router.get("/user/:id", async ({ params }) => {
return params.id;
});
server.optimize();

createServer(server.handle.bind(server)).listen(3000, () => {
console.log('listening on 3000')
})
console.log("listening on 3000");
});
39 changes: 19 additions & 20 deletions javascript/adonisjs/config/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* file.
*/

import proxyAddr from 'proxy-addr'
import Env from '@ioc:Adonis/Core/Env'
import type { ServerConfig } from '@ioc:Adonis/Core/Server'
import type { LoggerConfig } from '@ioc:Adonis/Core/Logger'
import type { ProfilerConfig } from '@ioc:Adonis/Core/Profiler'
import type { ValidatorConfig } from '@ioc:Adonis/Core/Validator'
import proxyAddr from "proxy-addr";
import Env from "@ioc:Adonis/Core/Env";
import type { ServerConfig } from "@ioc:Adonis/Core/Server";
import type { LoggerConfig } from "@ioc:Adonis/Core/Logger";
import type { ProfilerConfig } from "@ioc:Adonis/Core/Profiler";
import type { ValidatorConfig } from "@ioc:Adonis/Core/Validator";

/*
|--------------------------------------------------------------------------
Expand All @@ -25,7 +25,7 @@ import type { ValidatorConfig } from '@ioc:Adonis/Core/Validator'
| be decrypted.
|
*/
export const appKey: string = Env.get('APP_KEY')
export const appKey: string = Env.get("APP_KEY");

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -77,7 +77,7 @@ export const http: ServerConfig = {
| headers.
|
*/
trustProxy: proxyAddr.compile('loopback'),
trustProxy: proxyAddr.compile("loopback"),

/*
|--------------------------------------------------------------------------
Expand All @@ -94,22 +94,22 @@ export const http: ServerConfig = {
| JSONP Callback
|--------------------------------------------------------------------------
*/
jsonpCallbackName: 'callback',
jsonpCallbackName: "callback",

/*
|--------------------------------------------------------------------------
| Cookie settings
|--------------------------------------------------------------------------
*/
cookie: {
domain: '',
path: '/',
maxAge: '2h',
domain: "",
path: "/",
maxAge: "2h",
httpOnly: true,
secure: false,
sameSite: false,
},
}
};

/*
|--------------------------------------------------------------------------
Expand All @@ -129,7 +129,7 @@ export const logger: LoggerConfig = {
| reading the `name` property from the `package.json` file.
|
*/
name: Env.get('APP_NAME'),
name: Env.get("APP_NAME"),

/*
|--------------------------------------------------------------------------
Expand All @@ -151,7 +151,7 @@ export const logger: LoggerConfig = {
| at deployment level and not code level.
|
*/
level: Env.get('LOG_LEVEL', 'info'),
level: Env.get("LOG_LEVEL", "info"),

/*
|--------------------------------------------------------------------------
Expand All @@ -162,8 +162,8 @@ export const logger: LoggerConfig = {
| can have huge impact on performance.
|
*/
prettyPrint: Env.get('NODE_ENV') === 'development',
}
prettyPrint: Env.get("NODE_ENV") === "development",
};

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -202,7 +202,7 @@ export const profiler: ProfilerConfig = {
|
*/
whitelist: [],
}
};

/*
|--------------------------------------------------------------------------
Expand All @@ -213,5 +213,4 @@ export const profiler: ProfilerConfig = {
| to the default config https://git.io/JT0WE
|
*/
export const validator: ValidatorConfig = {
}
export const validator: ValidatorConfig = {};
44 changes: 19 additions & 25 deletions javascript/adonisjs/config/bodyparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file.
*/

import type { BodyParserConfig } from '@ioc:Adonis/Core/BodyParser'
import type { BodyParserConfig } from "@ioc:Adonis/Core/BodyParser";

const bodyParserConfig: BodyParserConfig = {
/*
Expand All @@ -17,7 +17,7 @@ const bodyParserConfig: BodyParserConfig = {
| to avoid body parsing for `GET` requests.
|
*/
whitelistedMethods: ['POST', 'PUT', 'PATCH', 'DELETE'],
whitelistedMethods: ["POST", "PUT", "PATCH", "DELETE"],

/*
|--------------------------------------------------------------------------
Expand All @@ -29,14 +29,14 @@ const bodyParserConfig: BodyParserConfig = {
|
*/
json: {
encoding: 'utf-8',
limit: '1mb',
encoding: "utf-8",
limit: "1mb",
strict: true,
types: [
'application/json',
'application/json-patch+json',
'application/vnd.api+json',
'application/csp-report',
"application/json",
"application/json-patch+json",
"application/vnd.api+json",
"application/csp-report",
],
},

Expand All @@ -50,8 +50,8 @@ const bodyParserConfig: BodyParserConfig = {
|
*/
form: {
encoding: 'utf-8',
limit: '1mb',
encoding: "utf-8",
limit: "1mb",
queryString: {},

/*
Expand All @@ -66,9 +66,7 @@ const bodyParserConfig: BodyParserConfig = {
*/
convertEmptyStringsToNull: true,

types: [
'application/x-www-form-urlencoded',
],
types: ["application/x-www-form-urlencoded"],
},

/*
Expand All @@ -82,12 +80,10 @@ const bodyParserConfig: BodyParserConfig = {
|
*/
raw: {
encoding: 'utf-8',
limit: '1mb',
encoding: "utf-8",
limit: "1mb",
queryString: {},
types: [
'text/*',
],
types: ["text/*"],
},

/*
Expand Down Expand Up @@ -158,7 +154,7 @@ const bodyParserConfig: BodyParserConfig = {
| Request body encoding
|
*/
encoding: 'utf-8',
encoding: "utf-8",

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -192,7 +188,7 @@ const bodyParserConfig: BodyParserConfig = {
| and fields data.
|
*/
limit: '20mb',
limit: "20mb",

/*
|--------------------------------------------------------------------------
Expand All @@ -202,10 +198,8 @@ const bodyParserConfig: BodyParserConfig = {
| The types that will be considered and parsed as multipart body.
|
*/
types: [
'multipart/form-data',
],
types: ["multipart/form-data"],
},
}
};

export default bodyParserConfig
export default bodyParserConfig;
20 changes: 10 additions & 10 deletions javascript/adonisjs/config/cors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file.
*/

import type { CorsConfig } from '@ioc:Adonis/Core/Cors'
import type { CorsConfig } from "@ioc:Adonis/Core/Cors";

const corsConfig: CorsConfig = {
/*
Expand Down Expand Up @@ -56,7 +56,7 @@ const corsConfig: CorsConfig = {
|
| Following is the list of default methods. Feel free to add more.
*/
methods: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE'],
methods: ["GET", "HEAD", "POST", "PUT", "DELETE"],

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -98,12 +98,12 @@ const corsConfig: CorsConfig = {
|
*/
exposeHeaders: [
'cache-control',
'content-language',
'content-type',
'expires',
'last-modified',
'pragma',
"cache-control",
"content-language",
"content-type",
"expires",
"last-modified",
"pragma",
],

/*
Expand All @@ -129,6 +129,6 @@ const corsConfig: CorsConfig = {
|
*/
maxAge: 90,
}
};

export default corsConfig
export default corsConfig;
Loading

0 comments on commit 228e8fc

Please sign in to comment.