Skip to content

Commit

Permalink
Merge pull request #2 from njfamirm/feat/deploy
Browse files Browse the repository at this point in the history
Feat/deploy
  • Loading branch information
njfamirm committed Jul 1, 2023
2 parents 4b093b2 + 9c9d723 commit b6e283d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import './route/home.js'
import './route/auth.js'
import './route/callback.js'
5 changes: 3 additions & 2 deletions src/route/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ nanoServer.route('GET', '/auth', (connection) => {
if (provider !== 'github') {
return {
ok: false,
errorCode: 'invalid_provider',
statusCode: 400,
errorCode: 'invalid_provider',
};
}

Expand All @@ -29,9 +29,10 @@ nanoServer.route('GET', '/auth', (connection) => {
state: randomString(),
});

connection.serverResponse.writeHead(301, { Location: authorizationUri });
connection.serverResponse.setHeader('Location', authorizationUri);
return {
ok: true,
statusCode: 301,
data: {},
};
});
9 changes: 9 additions & 0 deletions src/route/home.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {nanoServer} from '../lib/nano-server.js';

nanoServer.route('GET', '/', () => ({
ok: true,
data: {
app: '..:: Alwatr Decap CMS Backend Nanoservice ::..',
message: 'Hello ;)',
},
}));

0 comments on commit b6e283d

Please sign in to comment.