Skip to content

Commit

Permalink
update default url
Browse files Browse the repository at this point in the history
  • Loading branch information
asim committed Nov 17, 2021
1 parent 87fb721 commit e0f62f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "micro-js-client",
"version": "0.0.1",
"version": "0.0.2",
"description": "Micro JS Client",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
13 changes: 2 additions & 11 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import * as url from 'url';
import {Stream} from './stream';

const defaultPrefix = 'v1/';
const defaultLocal = 'http://localhost:8080/';
const defaultLive = 'https://api.m3o.com/';
const defaultAddress = 'http://localhost:8080/';

export interface Options {
token?: string;
Expand All @@ -15,8 +14,6 @@ export interface Options {
address?: string;
// Helper flag to set the url prefix of the server
prefix?: string;
// Helper flag to help users connect to the default local address
local?: boolean;
}

/**
Expand All @@ -26,25 +23,19 @@ export interface ClientOptions {
token?: string;
address: string;
prefix: string;
local: boolean;
}

export class Client {
public options: ClientOptions = {
address: defaultLive,
address: defaultAddress,
prefix: defaultPrefix,
local: false,
};

constructor(options?: Options) {
if (options) {
if (options.token) {
this.options.token = options.token;
}
if (options.local) {
this.options.local = true;
this.options.address = defaultLocal;
}
if (options.address) {
this.options.address = options.address;
}
Expand Down

0 comments on commit e0f62f3

Please sign in to comment.