This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const ACCOUNT = '375917'; | |
const SECRET = 'SAIPPUAKAUPPIAS'; | |
const headers = { | |
'checkout-account': ACCOUNT, | |
'checkout-algorithm': 'sha256', | |
'checkout-method': 'POST' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
import * as proj4 from 'proj4'; | |
interface Result { | |
readonly features: ReadonlyArray<{ | |
readonly properties: { | |
readonly posti_alue: string; | |
}; | |
}>; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import routeHandler from '../src/routeHandler'; | |
import { mockResponse, mockRequest } from './test-helpers'; | |
jest.mock('@googlemaps/google-maps-services-js'); | |
import { Client } from '@googlemaps/google-maps-services-js'; | |
const mockClient = { | |
geocode: jest.fn(), | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert postal number geometries to WGS84 coordinates for geocoding | |
*/ | |
import axios from 'axios'; | |
import * as proj4 from 'proj4'; | |
import * as turf from '@turf/turf'; | |
import { promisify } from 'util'; | |
import * as fs from 'fs'; | |
const writeFile = promisify(fs.writeFile); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const Main: React.FunctionComponent = () => { | |
const [ markers, setMarkers ] = React.useState<ReadonlyArray<Marker>>([]); | |
// Need to be in separate files for lazy loading, otherwise using window.google.maps | |
// in the actual map component will throw | |
return ( | |
<LoadScript googleMapsApiKey={apiKey}> | |
<Map markers={markers} /> | |
</LoadScript> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Static, Type } from '@sinclair/typebox' | |
import fastify, { FastifyInstance, FastifyPluginAsync } from 'fastify' | |
import type { RouteGenericInterface, RouteHandler } from 'fastify/types/route' | |
const port = 8080 | |
const requestBodySchema = Type.Object({ | |
email: Type.Readonly(Type.String({ format: 'email' })), | |
}) |
OlderNewer